In my adventures of searching for telling teaching a small xulrunner application I'm working on to use the commandline, I found Crowbar, a project out of MIT that's pretty neat.
Basically I wanted the power of my xpathtool but twist it with some help from jQuery. A command-line jquery tool would let you do some pretty neat things with web scraping. Crowbar can already do the page fetching, but I want to do more. And no, by 'command-line jquery tool' I certainly do not mean this command line jquery documentation tool.
My frustration with XPCOM's burden-the-programmer design has me at the end of my patience for tonight. Basically I suck at XPCOM in JavaScript. I'll keep at it though, maybe something useful will come out. come out of it.
Update: Neat! While surfing through Crowbar's code for how they handle commandline arguments, I found this beauty:
/*
* Process a series of command line arguments and modify default settings
*/
function processCommandLineArgs() {
var nsCommandLine = window.arguments[0];
nsCommandLine = nsCommandLine.QueryInterface(Components.interfaces.nsICommandLine);
port = getCommandLineArg(nsCommandLine, 'port', port);
}
So, I try this out myself:
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="alert(window.arguments[0].QueryInterface(Components.interfaces.nsICommandLine).getArgument(0))" />
And run xulrunner:
% xulrunner application.ini happypantsThe result is this: