Class: Option - tj/commander.js GitHub Wiki
Note: This page is incomplete. Contribute by adding information.
Option(flags[, description])
new Option(flags[, description])
Initialize a new Option with the given flags and description.
Parameters
flags, typestring: The flags that can be used when calling the command. Same asProgram.option().description(optional), typestring: The description that is used in the automated help page. Same asProgram.option().
Methods
argParser([fn])
Set the custom handler for processing CLI option arguments into option values.
Parameters:
fn(optional), typefunction
attributeName()
Return option name, in a camelcase format that can be used as a object attribute key.
Returns:
string: The name of the option in camelcase format
choices(values)
Only allow option value to be one of choices.
Parameters:
values, typeArray[string]: Array of choices allowed
Returns:
Option: The object itself for chaining
default(value[, description])
Set the default value, and optionally supply the description to be displayed in the help.
Parameters:
value, any type: The default valuedescription(optional), typestring: The description that is shown on the help page
Returns:
Option: The object itself for chaining
env(name)
Set the environment variable that is used to check for an option value.