You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -82,14 +82,13 @@ Multiple short flags may optionally be combined in a single argument following t
82
82
For example `-a -b -p 80` may be written as `-ab -p80` or even `-abp80`.
83
83
84
84
You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted.
85
-
This is particularly useful for passing options through to another
86
-
command, like: `do -- git --version`.
87
85
88
-
Options on the command line are not positional, and can be specified before or after other command arguments.
86
+
Options on the command line are not positional, and can be specified before or after other arguments.
89
87
90
88
### Common option types, boolean and value
91
89
92
-
The two most used option types are a boolean flag, and an option which takes a value (declared using angle brackets). Both are `undefined` unless specified on command line.
90
+
The two most used option types are a boolean option, and an option which takes its value
91
+
from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
93
92
94
93
Example file: [options-common.js](./examples/options-common.js)
You may make an option variadic by appending `...` to the value placeholder when declaring the option. On the command line you
289
-
can then specify multiple optionarguments, and the parsed option value will be an array. The extra arguments
289
+
can then specify multiple option-arguments, and the parsed option value will be an array. The extra arguments
290
290
are readuntil the first argument starting with a dash. The special argument `--` stops option processing entirely. If a value
291
291
is specified in the same argument as the option then no further values are read.
292
292
@@ -341,7 +341,7 @@ program.version('0.0.1', '-v, --vers', 'output the current version');
341
341
342
342
You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)).
343
343
344
-
In the first parameter to `.command()` you specify the command name and any commandarguments. The arguments may be `<required>` or `[optional]`, and the last argument may also be `variadic...`.
344
+
In the first parameter to `.command()` you specify the command name and any command-arguments. The arguments may be `<required>` or `[optional]`, and the last argument may also be `variadic...`.
345
345
346
346
You can use `.addCommand()` to add an already configured subcommand to the program.
347
347
@@ -369,11 +369,15 @@ program
369
369
.addCommand(build.makeBuildCommand());
370
370
```
371
371
372
-
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `true`for`opts.hidden` will remove the command from the generated help output. Specifying `true`for`opts.isDefault` will run the subcommand if no other subcommand is specified ([example](./examples/defaultCommand.js)).
372
+
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
373
+
remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other
374
+
subcommand is specified ([example](./examples/defaultCommand.js)).
373
375
374
376
### Specify the argument syntax
375
377
376
-
You use `.arguments` to specify the arguments forthe top-level command, and for subcommands they are usually includedin the `.command` call. Angled brackets (e.g. `<required>`) indicate required input. Square brackets (e.g. `[optional]`) indicate optional input.
378
+
You use `.arguments` to specify the expected command-arguments for the top-level command, and for subcommands they are usually
379
+
included in the `.command` call. Angled brackets (e.g. `<required>`) indicate required command-arguments.
0 commit comments