Members
__commands :Array.<typeProgramObj>
- Source:
The inner objects defined with Wsh.Commander.addProgram.
Type:
- Array.<typeProgramObj>
Type Definitions
typeCommanderSchema
- Source:
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
command |
string |
<optional> |
''
|
The command and arguments. e.g1: 'play' e.g2: 'play <consoleName> [gameTitle]' |
description |
string |
<optional> |
The command description. |
|
version |
string | typeVersionSchema |
<optional> |
The schema of command version. |
|
options |
Array.<typeOptionSchema> |
<optional> |
An Array of command option schemas. |
|
requiredOptions |
Array.<typeOptionSchema> |
<optional> |
An Array of required option schemas. |
|
action |
function |
<optional> |
The function to execute. |
|
helpOption |
typeHelpSchema |
<optional> |
The schema of command help. |
Type:
- object
Example
{
command: 'connect <resourceName>',
description: 'The command to connect my PC to a resource',
version: '0.5.1',
requiredOptions: [
['-p, --password', 'The password to connect']
],
options: [
['-d, --domain-name <name>', 'A domain name of the resource'],
['-n, --user-name [name]', 'A user name to log in', 'Tuckn']
],
action: function (resourceName, options) {
if (options.domainName) {
connRsrc(processName, options.password,
options.domainName + '\\' + options.userName);
} else {
connRsrc(processName, options.password, options.userName);
}
}
}
typeCommandObj
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
name |
string | |
isRequired |
boolean | |
isArray |
boolean | The following val type |
val |
string | Array.<string> | If isArray is true, Array. not String |
schema |
string | The source schema |
Type:
- object
typeCommandObject
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
name |
string | |
description |
string | |
version |
object | |
help |
object | |
options |
Array | |
args |
Array.<typeCommandObj> |
Type:
- object
typeHelpObject
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
name |
string | The option name. |
shortFlag |
string | The short flag. |
longFlag |
string | The long flag. |
description |
string | |
val |
string | A help message when shows in CLI. |
schema |
string | typeHelpSchema | The source schema. |
Type:
- object
Example
{ name: 'showHelp',
shortFlag: '-S',
longFlag: '--show-help',
description: 'Show the help',
val: '', // Auto create with _createCmdHelpMsg(cmdObj)
schema: ['-S, --show-help', 'Show the help'] }
typeHelpSchema
- Source:
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
version |
string | ||
flagSchema |
string | ||
description |
string |
<optional> |
Type:
- array
Example
['-S, --show-help', 'Show the help']
typeOptionObject
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
name |
string | A option name |
shortFlag |
string | A Short Flag. Ex. "-G" |
longFlag |
string | A Long Flag. Ex. "--game-title" |
valType |
string | "VALUE", |
description |
string | |
isRequired |
boolean | |
isPairWithVal |
boolean | |
isSpecified |
boolean | |
isArray |
boolean | |
val |
string | undefined | |
initFunc |
function | undefined | |
schema |
typeOptionSchema | The source schema. Ex. ['-G, --game-title [title]', 'A game name'] |
valSchema: |
string | '[title]' |
Type:
- object
Example
{ name: "gameTitle",
shortFlag: "-G",
longFlag: "--game-title",
valType: "VALUE",
description: "A game name",
isRequired: false,
isPairWithVal: false,
isSpecified: false,
isArray: false,
val: undefined,
initFunc: undefined,
schema: ['-G, --game-title [title]', 'A game name']
valSchema: '[title]' }
typeOptionSchema
- Source:
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
flagSchema |
string | Ex. '-O, --switch-no' |
|
description |
string |
<optional> |
|
process |
function |
<optional> |
|
default |
any |
<optional> |
The default/starting value |
Type:
- array
Example
// Ex.1
['-O, --switch-no', 'Normally opened switch']
// Ex. 2
['-I, --increment <Number>', 'Example of processing', function (num, pre) {
return pre + num;
}, 3]
typeProgramObj
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
name |
string | The program name. |
args |
Array.<typeCommandObj> | The program arguments. |
description |
string | The program description. |
version |
typeVersionObject | The object of program version. |
help |
typeHelpObject | The object of program help. |
options |
Array.<typeOptionObject> | The program options. |
action |
function | The function to execute. |
Type:
- object
Example
{ name: 'playgame',
args: [
{
name: 'consoleName',
isRequired: false,
isArray: false,
isSpecified: false,
val: undefined,
schema: '[consoleName]'
},
{}...
],
description: 'Playing Game Command for CLI',
version: {
name: 'vers',
shortFlag: '-v',
longFlag: '--ver',
description: 'Output the current version',
val: '1.0.0',
schema: ['0.0.1', '-v, --vers', 'Output the current version']
},
help: {
name: 'showHelp',
shortFlag: '-S',
longFlag: '--show-help',
description: 'Show the help',
val: 'Usage: ... [options]\n\n ...',
schema: ['-S, --show-help', 'Show help']
},
options: [
{ name: 'gameTitle',
shortFlag: '-G',
longFlag: '--game-title',
valType: 'VALUE',
description: 'A game name',
isRequired: false,
isPairWithVal: false,
isSpecified: false,
isArray: false,
val: undefined,
initFunc: undefined,
schema: ['-G, --game-title [title]', 'A game name']
valSchema: '[title]' },
{ ... },
...
],
action: function (console, ..., options) { ... } }
typeVersionObject
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
name |
string | |
shortFlag |
string | |
longFlag |
string | |
description |
string | |
schema |
string | typeVersionSchema |
Type:
- object
Example
{ name: 'vers',
shortFlag: '-v',
longFlag: '--ver',
description: 'Output the current version',
val: '1.0.0',
schema: ['0.0.1', '-v, --vers', 'Output the current version'] }
typeVersionSchema
- Source:
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
version |
string | ||
flagSchema |
string | ||
description |
string |
<optional> |
Type:
- array
Example
['0.0.1', '-v, --vers', 'Output the current version']