cli
Function - addCommand
Description: The addCommand function registers a new command to the command pool.
Returns: A Command object to set additional information, eg. flags.
Name | Type | Description |
---|---|---|
path | string |
The command name. For nested commands, separate each name with a dot. |
callback | function |
The function that will be called when the command is used. |
Function - question
Description: Prompts the user for input. (stdin, stdout)
Returns: A promise containing the answer as a string.
Name | Type | Description |
---|---|---|
message | string |
The message that comes before the user input. |
Function - log
Description: An alternative to console.log() with color styling capabilities.
Name | Type | Description |
---|---|---|
args | string[] |
An array of strings to be written to stdout. |
Command
Type alias - FlagTypeNames
Description: The names of the types that a command flag can be.
Type: "any" | "string" | "boolean" | "number"
Method - addFlag
Description: Registers a flag to a command.
Returns: A command object for chaining.
Name | Type | Description |
---|---|---|
name | string |
The name of the flag. Use "*" to accept any flag. |
type | FlagTypeNames |
The type of value this flag will accept. "any" by default. |
required | boolean |
Is this flag required or optional? |