Update checked-in dependencies
This commit is contained in:
parent
25fef55830
commit
5fee2f2ed7
8 changed files with 337 additions and 587 deletions
42
node_modules/commander/Readme.md
generated
vendored
42
node_modules/commander/Readme.md
generated
vendored
|
|
@ -30,6 +30,7 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
|
|||
- [Life cycle hooks](#life-cycle-hooks)
|
||||
- [Automated help](#automated-help)
|
||||
- [Custom help](#custom-help)
|
||||
- [Display help after errors](#display-help-after-errors)
|
||||
- [Display help from code](#display-help-from-code)
|
||||
- [.usage and .name](#usage-and-name)
|
||||
- [.helpOption(flags, description)](#helpoptionflags-description)
|
||||
|
|
@ -112,7 +113,7 @@ By default options on the command line are not positional, and can be specified
|
|||
### Common option types, boolean and value
|
||||
|
||||
The two most used option types are a boolean option, and an option which takes its value
|
||||
from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
|
||||
from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
|
||||
|
||||
Example file: [options-common.js](./examples/options-common.js)
|
||||
|
||||
|
|
@ -425,7 +426,7 @@ program
|
|||
.addCommand(build.makeBuildCommand());
|
||||
```
|
||||
|
||||
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
|
||||
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
|
||||
remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other
|
||||
subcommand is specified ([example](./examples/defaultCommand.js)).
|
||||
|
||||
|
|
@ -435,7 +436,7 @@ For subcommands, you can specify the argument syntax in the call to `.command()`
|
|||
is the only method usable for subcommands implemented using a stand-alone executable, but for other subcommands
|
||||
you can instead use the following method.
|
||||
|
||||
To configure a command, you can use `.argument()` to specify each expected command-argument.
|
||||
To configure a command, you can use `.argument()` to specify each expected command-argument.
|
||||
You supply the argument name and an optional description. The argument may be `<required>` or `[optional]`.
|
||||
You can specify a default value for an optional command-argument.
|
||||
|
||||
|
|
@ -488,10 +489,12 @@ program
|
|||
|
||||
#### Custom argument processing
|
||||
|
||||
You may specify a function to do custom processing of command-arguments before they are passed to the action handler.
|
||||
You may specify a function to do custom processing of command-arguments (like for option-arguments).
|
||||
The callback function receives two parameters, the user specified command-argument and the previous value for the argument.
|
||||
It returns the new value for the argument.
|
||||
|
||||
The processed argument values are passed to the action handler, and saved as `.processedArgs`.
|
||||
|
||||
You can optionally specify the default/starting value for the argument after the function parameter.
|
||||
|
||||
Example file: [arguments-custom-processing.js](./examples/arguments-custom-processing.js)
|
||||
|
|
@ -510,7 +513,7 @@ program
|
|||
### Action handler
|
||||
|
||||
The action handler gets passed a parameter for each command-argument you declared, and two additional parameters
|
||||
which are the parsed options and the command object itself.
|
||||
which are the parsed options and the command object itself.
|
||||
|
||||
Example file: [thank.js](./examples/thank.js)
|
||||
|
||||
|
|
@ -627,7 +630,7 @@ shell spawn --help
|
|||
|
||||
### Custom help
|
||||
|
||||
You can add extra text to be displayed along with the built-in help.
|
||||
You can add extra text to be displayed along with the built-in help.
|
||||
|
||||
Example file: [custom-help](./examples/custom-help)
|
||||
|
||||
|
|
@ -661,13 +664,30 @@ The positions in order displayed are:
|
|||
- `after`: display extra information after built-in help
|
||||
- `afterAll`: add to the program for a global footer (epilog)
|
||||
|
||||
The positions "beforeAll" and "afterAll" apply to the command and all its subcommands.
|
||||
The positions "beforeAll" and "afterAll" apply to the command and all its subcommands.
|
||||
|
||||
The second parameter can be a string, or a function returning a string. The function is passed a context object for your convenience. The properties are:
|
||||
|
||||
- error: a boolean for whether the help is being displayed due to a usage error
|
||||
- command: the Command which is displaying the help
|
||||
|
||||
### Display help after errors
|
||||
|
||||
The default behaviour for usage errors is to just display a short error message.
|
||||
You can change the behaviour to show the full help or a custom help message after an error.
|
||||
|
||||
```js
|
||||
program.showHelpAfterError();
|
||||
// or
|
||||
program.showHelpAfterError('(add --help for additional information)');
|
||||
```
|
||||
|
||||
```sh
|
||||
$ pizza --unknown
|
||||
error: unknown option '--unknown'
|
||||
(add --help for additional information)
|
||||
```
|
||||
|
||||
### Display help from code
|
||||
|
||||
`.help()`: display help information and exit immediately. You can optionally pass `{ error: true }` to display on stderr and exit with an error status.
|
||||
|
|
@ -727,7 +747,7 @@ There are methods getting the visible lists of arguments, options, and subcomman
|
|||
|
||||
Example file: [configure-help.js](./examples/configure-help.js)
|
||||
|
||||
```
|
||||
```js
|
||||
program.configureHelp({
|
||||
sortSubcommands: true,
|
||||
subcommandTerm: (cmd) => cmd.name() // Just show the name, instead of short usage.
|
||||
|
|
@ -789,7 +809,7 @@ program subcommand -b
|
|||
|
||||
By default options are recognised before and after command-arguments. To only process options that come
|
||||
before the command-arguments, use `.passThroughOptions()`. This lets you pass the arguments and following options through to another program
|
||||
without needing to use `--` to end the option processing.
|
||||
without needing to use `--` to end the option processing.
|
||||
To use pass through options in a subcommand, the program needs to enable positional options.
|
||||
|
||||
Example file: [pass-through-options.js](./examples/pass-through-options.js)
|
||||
|
|
@ -806,7 +826,7 @@ By default the option processing shows an error for an unknown option. To have a
|
|||
By default the argument processing does not display an error for more command-arguments than expected.
|
||||
To display an error for excess arguments, use`.allowExcessArguments(false)`.
|
||||
|
||||
### Legacy options as properties
|
||||
### Legacy options as properties
|
||||
|
||||
Before Commander 7, the option values were stored as properties on the command.
|
||||
This was convenient to code but the downside was possible clashes with
|
||||
|
|
@ -966,7 +986,7 @@ Examples:
|
|||
$ deploy exec sequential
|
||||
$ deploy exec async`
|
||||
);
|
||||
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue