-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Class: Option
Maytham edited this page Oct 2, 2021
·
3 revisions
Note: This page is incomplete. Contribute by adding information.
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()
.
Set the custom handler for processing CLI option arguments into option values.
Parameters:
-
fn
(optional), typefunction
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
Only allow option value to be one of choices.
Parameters:
-
values
, typeArray[string]
: Array of choices allowed
Returns:
-
Option
: The object itself for chaining
Set the default value, and optionally supply the description to be displayed in the help.
Parameters:
-
value
, any type: The default value -
description
(optional), typestring
: The description that is shown on the help page
Returns:
-
Option
: The object itself for chaining
Set the environment variable that is used to check for an option value.