enum Cmdr.Context |
|
XDCscript usage |
meta-domain |
values of type Cmdr.Context
const Cmdr.SHELL;
const Cmdr.SCRIPT;
per-instance config parameters |
|
XDCscript usage |
meta-domain |
var params = new Cmdr.Params;
// Instance config-params object
//
params.socket = Any null;
//
params.tid = Int 0;
//
config Cmdr.context // per-instance |
|
XDCscript usage |
meta-domain |
var params = new Cmdr.Params;
...
config Cmdr.socket // per-instance |
|
XDCscript usage |
meta-domain |
var params = new Cmdr.Params;
...
params.socket = Any null;
config Cmdr.tid // per-instance |
|
XDCscript usage |
meta-domain |
var params = new Cmdr.Params;
...
params.tid = Int 0;
per-instance creation |
|
XDCscript usage |
meta-domain |
// Allocate instance config-params
params.config = ...
// Assign individual configs
var inst = Cmdr.create( Any cmdmod, params );
// Create an instance-object
Cmdr.error( ) // per-instance |
|
XDCscript usage |
meta-domain |
inst.error( Any msg ) returns Any
Cmdr.getopts( ) // per-instance |
|
Parse command-line arguments into config params
XDCscript usage |
meta-domain |
inst.getopts( Any inst, Any args ) returns Any
ARGUMENTS
inst
instance with config parameters to set
args
an array of command-line arguments
DETAILS
This function accepts an array of command-line arguments, and
uses them to set the values of config parameters in a module
instance. Parsing is controlled by the XDC declarations of the
instance config params.
USAGE
The following command-line argument syntaxes are supported,
following the syntax supported by GNU getopt() and getopt_long():
-f a boolean flag with short name
-f value a number or string with short name
-fvalue
-f=value
--longname a boolean flag with long name
--longname value a number or string with long name
--longname=value a number or string with long name
In addition the following non-standard syntaxes are supported:
-f:value
--longnamevalue
--longname:value
DECLARATION
The long and short names of the config parameter are declared
by the @CommandOption() attribute of the XDC spec language. For
example to declare a boolean flag with a short name of "-f" and
a long name of "--flag", and a default value of false:
@ CommandOption("f,flag")
config Bool myFlag = false;
Options of type Bool with no argument are assigned the value
"true". The types String and Int can also be used, and always
require an argument to be given on the command line.
COMBINING SHORT FLAGS
Short-name options can be combined on the command line where there
is no ambiguity, for example the following usages are equivalent:
-a -b -c -f filename
-abcf filename
MULTIPLE OCCURRENCES
If the config param is declared as an array, the option may
be used multiple times on the command line and each occurence
will be recorded. For example the following records all -I
options, in order:
@ CommandOption("I")
config String includeDirs[] = [];
REQUIRED OPTIONS
If the config param has no default value declared, then it
is required on the command line, and a Javascript exception will
be raised if it is omitted.
Cmdr.info( ) // per-instance |
|
XDCscript usage |
meta-domain |
inst.info( Any msg ) returns Any
Cmdr.read( ) // per-instance |
|
XDCscript usage |
meta-domain |
Cmdr.time( ) // per-instance |
|
XDCscript usage |
meta-domain |
inst.time( Any msg ) returns Any
Cmdr.usage( ) // per-instance |
|
XDCscript usage |
meta-domain |
inst.usage( ) returns Any
Cmdr.verbose( ) // per-instance |
|
XDCscript usage |
meta-domain |
inst.verbose( Any flag ) returns Any
Cmdr.warning( ) // per-instance |
|
XDCscript usage |
meta-domain |
inst.warning( Any msg ) returns Any
Cmdr.write( ) // per-instance |
|
XDCscript usage |
meta-domain |
inst.write( Any s ) returns Any