Hacker News new | ask | show | jobs
by greenyoda 5035 days ago
It would be nice if the command line supported a shell-like language that would allow you to easily parameterize and script these Firefox commands. So instead of running one command at a time, you could create files that ran commands sequentially, iteratively, etc. There could even be syntax that sets variables to the values of arbitrary JavaScript expressions (which would give you access to any DOM attribute, for example).
1 comments

perhaps use javascript for that?
JavaScript, and most contemporary languages for that matter, would be pretty poor choices for such a use case. In particular, the concern here is the need for a language that is commands first and expressions second. It's an analogous situation to template languages. Consider Ruby's erb, for example. It's like you took Ruby, made String interpolation the default, and provided an escape hatch to get to full Ruby, not just the limited interpolation subset.

It's kinda sad that the world seems to have forgotten Tcl: http://en.wikipedia.org/wiki/Tcl

In the case of tcl, you invert C functions (or another language with C-style calling conventions) to be callable by default as commands. You then have the [expr ...] escape hatch to toggle back to the non-default programing mode, that gives you expressions, arithmetic, and other general purpose programming language features.

I'd really love to see a Tcl++ type thing. It would be super cool if applications could easily drop a console, like this one from Mozilla, into their app. Bonus points if it comes complete with a help system, UI, completion, etc.!