Command line from TiddlyWiki

365 views
Skip to first unread message

stevesuny

unread,
Jun 20, 2017, 7:09:34 AM6/20/17
to TiddlyWiki
Hello,

Was wondering if anyone has built an interface to the command line from tiddlywiki. 

For example, given a tiddler tagged tag1 tag2 tag3, I might want to run these commands at the command line, from within tiddlywiki. 

grep tag1 ~/Documents/filename| grep tag2 | grep tag3  |cut -f3 > ~/Documents/outputs/grepped.lines
wc -l ~/Documents/outputs/grepped.lines > grepped.lines.linecount


and be able to import grepped.lines and grepped.lines.linecount as tiddlers.

Doable?

I suppose I could generate the commands in a tiddler, export it as a text file, and use it as a script, but was hoping to do it in one step.


Thanks,

//steve.

Jed Carty

unread,
Jun 20, 2017, 9:44:40 AM6/20/17
to TiddlyWiki
I would really like to be able to run a bash script from a tiddlywiki, but I haven't figured out how yet.

As I wrote that I realised that it should be possible to use the child_process module in node to run console commands, so we may be able to make widget that does that. That doesn't take care of the browser-vs-node scope problems, which would require something like what I made for robbie to pass the command between the browser and the main node process and then reply with the output.

Mark S.

unread,
Jun 20, 2017, 10:03:18 AM6/20/17
to TiddlyWiki
I suppose that you want the command line interface because you're comfortable with unix-style commands. But you might be able to do what you want without having to use a separate language.

This will create tiddlers that count the number of tiddlers marked 'Widget' and store it in a tiddler. You could modify for tag[tag1]tag[tag2] or whatever you wanted to count:

<$button>
<$wikify name="cnt" text="<$count filter='[tag[Widgets]]'/>">
<$action-createtiddler $basetitle="Current Widget Count"  text=<
<cnt>>/>
Record number of widgets
</$wikify>
</$button>

Good luck,
Mark

TonyM

unread,
Jul 15, 2017, 8:37:59 PM7/15/17
to TiddlyWiki
Steve,

Did you see this discussion on Windows Command line via a custom export (save in download) export and loop that processes?, Its quite easy to create a new exporter to do this and I am sure the same method can be used in other OS's.

Regards
Tony

TonyM

unread,
Jul 15, 2017, 8:39:55 PM7/15/17
to TiddlyWiki
P.S.

I was also going to share this custom export idea for your Spreadsheet tool to re-export.

PMario

unread,
Jul 17, 2017, 8:02:15 AM7/17/17
to TiddlyWiki
On Tuesday, June 20, 2017 at 3:44:40 PM UTC+2, Jed Carty wrote:
I would really like to be able to run a bash script from a tiddlywiki, but I haven't figured out how yet.

I'm pretty sure, that you don't want to run arbitrary scripts form untrusted sources on your computer, if the browser visits any page.

-m

@TiddlyTweeter

unread,
Jul 17, 2017, 10:25:00 AM7/17/17
to TiddlyWiki
i would trust it from a friend.

PMario wrote

codacoder...@outlook.com

unread,
Jul 17, 2017, 11:03:01 AM7/17/17
to TiddlyWiki


On Monday, July 17, 2017 at 9:25:00 AM UTC-5, @TiddlyTweeter wrote:
i would trust it from a friend.


A word of advice:

That is precisely the attack vector to which you (we) are most vulnerable.  You cannot know or ascertain whether your friends are or have been exposed to malware *designed* to use that precise attack vector.  Attackers and their code *rely* on us behaving that way.

Be safe. Take extreme care with ALL sources - even more care with friends.



 

@TiddlyTweeter

unread,
Jul 17, 2017, 12:15:33 PM7/17/17
to TiddlyWiki
I very much doubt its so dire. Since TW is NOT interactive the only ingress is if you compromised your own site. I DID mine by using an open FTP, never aqain.

So, do you want the 5 minute argument, or the full half hour? -:)


@TiddlyTweeter wrote:
i would trust it from a friend.
 
codacoder...@outlook.com wrote A word of advice:

.... Be safe. Take extreme care with ALL sources - even more care with friends.
 
Reply all
Reply to author
Forward
0 new messages