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
Copy file name to clipboardExpand all lines: Readme.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ By default options on the command line are not positional, and can be specified
113
113
### Common option types, boolean and value
114
114
115
115
The two most used option types are a boolean option, and an option which takes its value
116
-
from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
116
+
from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
117
117
118
118
Example file: [options-common.js](./examples/options-common.js)
119
119
@@ -426,7 +426,7 @@ program
426
426
.addCommand(build.makeBuildCommand());
427
427
```
428
428
429
-
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
429
+
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
430
430
remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other
431
431
subcommand is specified ([example](./examples/defaultCommand.js)).
432
432
@@ -436,7 +436,7 @@ For subcommands, you can specify the argument syntax in the call to `.command()`
436
436
is the only method usable for subcommands implemented using a stand-alone executable, but for other subcommands
437
437
you can instead use the following method.
438
438
439
-
To configure a command, you can use `.argument()` to specify each expected command-argument.
439
+
To configure a command, you can use `.argument()` to specify each expected command-argument.
440
440
You supply the argument name and an optional description. The argument may be `<required>` or `[optional]`.
441
441
You can specify a default value for an optional command-argument.
442
442
@@ -513,7 +513,7 @@ program
513
513
### Action handler
514
514
515
515
The action handler gets passed a parameter for each command-argument you declared, and two additional parameters
516
-
which are the parsed options and the command object itself.
516
+
which are the parsed options and the command object itself.
517
517
518
518
Example file: [thank.js](./examples/thank.js)
519
519
@@ -630,7 +630,7 @@ shell spawn --help
630
630
631
631
### Custom help
632
632
633
-
You can add extra text to be displayed along with the built-in help.
633
+
You can add extra text to be displayed along with the built-in help.
634
634
635
635
Example file: [custom-help](./examples/custom-help)
636
636
@@ -664,7 +664,7 @@ The positions in order displayed are:
664
664
- `after`: display extra information after built-in help
665
665
- `afterAll`: add to the program for a global footer (epilog)
666
666
667
-
The positions "beforeAll" and "afterAll" apply to the command and all its subcommands.
667
+
The positions "beforeAll" and "afterAll" apply to the command and all its subcommands.
668
668
669
669
The second parameter can be a string, or a functionreturning a string. The functionis passed a context object for your convenience. The properties are:
670
670
@@ -673,7 +673,7 @@ The second parameter can be a string, or a function returning a string. The func
673
673
674
674
### Display help after errors
675
675
676
-
The default behaviour for usage errors is to just display a short error message.
676
+
The default behaviour for usage errors is to just display a short error message.
677
677
You can change the behaviour to show the full help or a custom help message after an error.
678
678
679
679
```js
@@ -747,7 +747,7 @@ There are methods getting the visible lists of arguments, options, and subcomman
747
747
748
748
Example file: [configure-help.js](./examples/configure-help.js)
749
749
750
-
```
750
+
```js
751
751
program.configureHelp({
752
752
sortSubcommands: true,
753
753
subcommandTerm: (cmd) =>cmd.name() // Just show the name, instead of short usage.
@@ -809,7 +809,7 @@ program subcommand -b
809
809
810
810
By default options are recognised before and after command-arguments. To only process options that come
811
811
before the command-arguments, use `.passThroughOptions()`. This lets you pass the arguments and following options through to another program
812
-
without needing to use `--` to end the option processing.
812
+
without needing to use `--` to end the option processing.
813
813
To use pass through options in a subcommand, the program needs to enable positional options.
814
814
815
815
Example file: [pass-through-options.js](./examples/pass-through-options.js)
@@ -826,7 +826,7 @@ By default the option processing shows an error for an unknown option. To have a
826
826
By default the argument processing does not display an error for more command-arguments than expected.
827
827
To display an error for excess arguments, use`.allowExcessArguments(false)`.
828
828
829
-
### Legacy options as properties
829
+
### Legacy options as properties
830
830
831
831
Before Commander 7, the option values were stored as properties on the command.
832
832
This was convenient to code but the downside was possible clashes with
0 commit comments