Showing posts with label CLI. Show all posts
Showing posts with label CLI. Show all posts

Friday, October 10, 2014

Rich command shells

A very nice overview of what's out there at the moment (with history). I keep thinking I want to do this with SQP, but I'm still just not sure how it should look. (Probably the notebook thing.)

(Note to self: merge CLI and command line tags - they're the same thing...) (Or are they?!?)

Also, holy schemoley - xiki: xiki.org/screencasts/

Wednesday, January 8, 2014

Command-line in JavaScript

So I have a convenient little library-slash-utility kit (SQP - and I can't remember what it's supposed to stand for) that I use for private tools (my invoicing, my notes, household finances, that kind of thing); it consists of a wrapper for Perl's Term::Shell and includes convenience functions for arbitrary SQL, which it knows how to format nicely, and provides a useful framework for quick-and-dirty list and modification commands.

But it's still pretty clunky, and for a while now I've toyed with the idea of putting the CLI into JavaScript and fronting the whole thing from a local HTTP server, like Mojolicious.

Yesterday, I did just that, in about four hours. Turns out Mojolicious is very easy to wrap my head around, and it's been long past time to start hacking JavaScript, so ... all is well.

I hit a number of fascinating things while poking around looking for stuff:

  • Here's how easy it is to slap together a bare-bones CLI in jQuery. Look at the demo! It's freaking cool!  And that's probably the best framework for my son's planned text-based adventure game.
  • Naturally I also found things about JS from the command line, like this GlueScript: a Wx/JavaScript monstrosity that has me thinking hard (it looks pretty groovy; hack up your UI in a bundlable thing and attach an embedded Perl for CPAN-y things and man, you'd be cooking with gas!)
  • Another jQuery terminal - lots of features.
  • I ended up going with Termlib, and not only because its author is in Vienna while I sit in Budapest; it also has no jQuery dependency and it offers AJAX command handling out of the box without my thinking hard about it. So it was a natural choice.
  • Somewhere along the line I ran across PPI, a Perl DOM parser ... um, the Perl DOM parser actually.
Anyway, turns out it was dead easy to capture stdout and route it back to the browser. Where I'd really like to go with this is something a little more elaborate, though - more "textured" objects and larger text snippets returned from scripts should be placed into a return, and there should be a log.

What really kicked all this off is IPython, because Peter Norvig used it to analyze XKCD's recent regexp meta-golf (now you have infinite problems, hee) - for the exact same reason I wanted to - to play actual regexp meta-golf. IPython lets you work along interactively with data structures and hit code against them, but in a way I personally don't like. I want little editors to pop up and still keep that history and be able to switch to a notebook editor while I'm still working.  All that jazz. And if I do that in Wx (say) it will take me another twenty years - but in the browser I can do it in a couple of weeks.

So I'm gonna.

SQP is going to be my quasi-REPL, except I hate REPLs. I want a rich REPL, so that's what I'm going to write.  But of course it will also default back down to the command line if you're not in browser mode. (That actually also exists, in e.g. Perl::Shell and Shell::Perl and surely many others.)  Well, we'll see what I actually end up doing. The basic idea is the same, though. I want an interactive environment kind of like Mathematica, where I can see things in a nicely formatted way, put things into files, build files using templates and literate programming techniques, make schematics and diagrams with live links to items - who knows? All that and more.

Tuesday, October 22, 2013

Command lines in the browser

A lot of the tools I build for my own use are command-line-based (the various perl Shell modules are pretty useful and very quick to put together), so lately, since REST APIs seem to be a really nice way to build new functionality, I'm thinking, how can I do a command line in the browser?

Seems I'm not the first. Blue Sky on Mars posted on this topic in 2011 and even started a Google Group (which unfortunately didn't last too long).  These were more focused on shell replacements, though, which is more than I want or need.

But hey - Josh.js is perfect. And the examples are easy to understand. Add this to a Mojolicious backend and I think I've got a pretty snazzy way to organize functionality.

Thursday, August 9, 2012

Command lines

Here's an interesting point arguing that command lines are based on verbs and thus conceptually superior to GUIs, which are noun-based.  Hmm.  Or as he also puts it, CLIs are a linguistic interface, which I agree with.

The problem for me is that CLIs are far too restricted. Decl is about something like adding pronouns and antecedents.

Thursday, August 4, 2011

CLI musings

And just as my attention was drawn back towards CLIs, here's an article about why they're important. CLI = API = extensibility. (Which is not to say that some higher-level support wouldn't be welcome in a standard CLI interface, but still...)

Scripting CLIs

I got the crazy idea I should script Putty. It doesn't look amenable to scripting, so ... I had the idea of maybe doing something in Perl, and ran across Net::CLI::Interact, which looks frankly fascinating.