Jooscripts
Like Joolets, jooscripts are cmdlets of JavaSh. They are simple script written (for now) in javascript, and and interpreted by scriptengine of javash as if they were normal commands. They have some variables and a some methods that are called dynamically from the shell when is invoked their command:
- var command
contains the command managed by script - var help
contains script's information and usage - function main()
exec the command and set pobj
- args
array of arguments - pobj
piped object for pipes
/*
* Global variables passed to script:
*
* args - Array of String
* pobj - PipedObject
*
*/
// command managed
var command = "example";
// usage
var usage = "Usage:\n\t" + command + " <arguments>";
// help/info
var help =
"Name:\n" +
"\tExample\n" +
"Type:\n" +
"\tJooScript\n" +
"Description:\n" +
"\tExample script\n" +
"Options\n" +
usage;
// function that manage command
function main() {
// check arguments
if(args.length < 2) {
ShellConsole.println(usage);
}
// exec command...
// set pobj
pobj = ...
}
The engine used to manage the scripts is rhino. You can find interesting documentation at these sites: