metaonly interface xdc.tools.ICmd |
 |
 |
Generic xdc-script (xs) command
Modules that implement this interface can serve as "commands" that
can be executed from the command line (via
xs) or from within
XDCscript scripts (without having to fork a separate process to run
xs).
[
more ... ]
metaonly interface ICmd { ...
instance: ...
metaonly interface ICmd {
module-wide config parameters
module-wide functions
instance:
per-instance functions
}
DETAILS
Modules that implement this interface can serve as "commands" that
can be executed from the command line (via xs) or from within
XDCscript scripts (without having to fork a separate process to run
xs).
COMMAND LINE EXAMPLE
The following example runs the xdc.tools.path tool from the command
line to get an array of names of all packages below the current
working directory (".").
xs xdc.tools.path -n -a -PR .
XDCSCRIPT EXAMPLE
The following example runs the xdc.tools.path tool from within
a script to get an array of names of all packages below the current
working directory (".").
var Main = xdc.module('xdc.tools.path.Main');
var result = Main.exec(["-n", "-a", "-PR", "."]);
config ICmd.usage // module-wide |
 |
Usage for this command
config String usage[] = [ ];
ICmd.exec() // module-wide |
 |
xs script entry point
DETAILS
This function is called from within other XDCscript scripts and
performs the same operations as
main() except that,
rather than output the return value of
inst.run(), this value
is simply returned to the caller of
exec().
ICmd.main() // module-wide |
 |
xs shell entry point
DETAILS
This function
- creates a no-arg instance, inst, of the module inheriting
this interface;
- parses command line arguments placing all options in the config
params of the inheriting module;
- creates a xdc.tools.Cmdr instance, cmdr;
- calls inst.run() with the cmdr and any command
line command line arguments not parsed as options; and
- outputs the return result from inst.run()
ICmd.run() // instance |
 |
Underlying implementation of the command
DETAILS
Since this method is used to support both command line tools and
other XDCscript scripts, it is important to avoid explicit
termination of the JVM via java.lang.System.exit(); doing so
precludes callers from handling failures.
Implementations should instead call
generated on Wed, 09 Aug 2017 16:38:20 GMT