Members
(static) name
Get the name of the service provided by this unit: 'CliApp'
- Source:
(static) services
Defines the services required by this unit.
- Source:
Methods
get_help_option() → {module:flitter-cli/options/FlagOption~FlagOption}
Get the flag option that signals help. Usually, this is named 'help' and supports the flags '--help' and '-?'.
- Source:
(async) go(app, argvopt) → {Promise.<void>}
Loads the unit. Retrieves the CLI arguments and passes control off to the appropriate module:flitter-cli/Directive~Directive handler.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
app |
module:libflitter/app/FlitterApp~FlitterApp | the Flitter app |
||
argv |
Array.<string> |
<optional> |
process.argv.slice(2) | the CLI argv to be interpreted |
- Source:
- Type
- Promise.<void>
(async) handle_directive(app, DirectiveClass, args) → {Promise.<void>}
Handles an invocation of the specified directive class with the provided arguments.
Name | Type | Description |
---|---|---|
app |
module:libflitter/app/FlitterApp~FlitterAPp | the Flitter app |
DirectiveClass |
module:flitter-cli/Directive~Directive | the static CLASS of the directive |
args |
Array.<string> | the raw CLI arguments |
- Source:
- Type
- Promise.<void>
option_from_string(string) → {module:flitter-cli/options/FlagOption~FlagOption|module:flitter-cli/options/PositionalOption~PositionalOption}
Create an instance of module:flitter-cli/options/Option~Option based on a string definition of a particular format.
e.g. '{file name} | canonical name of the resource to create' e.g. '--push -p {value} | the value to be pushed' e.g. '--force -f | do a force push'
Name | Type | Description |
---|---|---|
string |
- Source:
process_options(option_classes, args) → {object}
Process the raw CLI arguments using an array of option class instances to build a mapping of option names to provided values.
Name | Type | Description |
---|---|---|
option_classes |
Array.<module:flitter-cli/option/Option~Option> | array of option definitions |
args |
Array.<string> | the raw CLI args |
- Source:
- the parsed options, by name
- Type
- object
requested_usage(args) → {boolean}
Determines if, at any point in the arguments, the help option's short or long flag appears.
Name | Type | Description |
---|---|---|
args |
Array.<string> | the raw CLI args |
- Source:
- true if the help flag appeared
- Type
- boolean