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
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -191,7 +191,7 @@ serve --port=80
191
191
192
192
You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted.
193
193
194
-
By default options on the command line are not positional, and can be specified before or after other arguments.
194
+
By default, options on the command line are not positional, and can be specified before or after other arguments.
195
195
196
196
There are additional related routines for when `.opts()` is not enough:
197
197
@@ -234,7 +234,7 @@ pizza details:
234
234
- cheese
235
235
```
236
236
237
-
Multiple boolean short options may be combined together following the dash, and may be followed by a single short option taking a value.
237
+
Multiple boolean short options may be combined following the dash, and may be followed by a single short option taking a value.
238
238
For example `-d -s -p cheese` may be written as `-ds -p cheese` or even `-dsp cheese`.
239
239
240
240
Options with an expected option-argument are greedy and will consume the following argument whatever the value.
@@ -678,7 +678,7 @@ async function main() {
678
678
}
679
679
```
680
680
681
-
A command's options and arguments on the command line are validated when the command is used. Any unknown options or missing arguments will be reported as an error. You can suppress the unknown option checks with `.allowUnknownOption()`. By default it is not an error to
681
+
A command's options and arguments on the command line are validated when the command is used. Any unknown options or missing arguments will be reported as an error. You can suppress the unknown option checks with `.allowUnknownOption()`. By default, it is not an error to
682
682
pass more arguments than declared, but you can make this an error with `.allowExcessArguments(false)`.
683
683
684
684
### Stand-alone executable (sub)commands
@@ -766,7 +766,7 @@ shell help spawn
766
766
shell spawn --help
767
767
```
768
768
769
-
Long descriptions are wrapped to fit the available width. (However, a description that includes a line-break followed by whitespace is assumed to be pre-formatted and not wrapped.)
769
+
Long descriptions are wrapped to fit the available width. (However, a description that includes a line-break followed by whitespace is assumed to be pre-formatted and not wrapped.)
If the default parsing does not suit your needs, there are some behaviours to support other usage patterns.
973
973
974
-
By default program options are recognised before and after subcommands. To only look for program options before subcommands, use `.enablePositionalOptions()`. This lets you use
974
+
By default, program options are recognised before and after subcommands. To only look for program options before subcommands, use `.enablePositionalOptions()`. This lets you use
975
975
an option for a different purpose in subcommands.
976
976
977
977
Example file: [positional-options.js](./examples/positional-options.js)
@@ -983,8 +983,8 @@ program -b subcommand
983
983
program subcommand -b
984
984
```
985
985
986
-
By default options are recognised before and after command-arguments. To only process options that come
987
-
before the command-arguments, use `.passThroughOptions()`. This lets you pass the arguments and following options through to another program
986
+
By default, options are recognised before and after command-arguments. To only process options that come
987
+
before the command-arguments, use `.passThroughOptions()`. This lets you pass the arguments and following options through to another program
988
988
without needing to use `--` to end the option processing.
989
989
To use pass through options in a subcommand, the program needs to enable positional options.
990
990
@@ -997,15 +997,15 @@ program --port=80 arg
997
997
program arg --port=80
998
998
```
999
999
1000
-
By default the option processing shows an error for an unknown option. To have an unknown option treated as an ordinary command-argument and continue looking for options, use `.allowUnknownOption()`. This lets you mix known and unknown options.
1000
+
By default, the option processing shows an error for an unknown option. To have an unknown option treated as an ordinary command-argument and continue looking for options, use `.allowUnknownOption()`. This lets you mix known and unknown options.
1001
1001
1002
-
By default the argument processing does not display an error for more command-arguments than expected.
1002
+
By default, the argument processing does not display an error for more command-arguments than expected.
1003
1003
To display an error for excess arguments, use`.allowExcessArguments(false)`.
1004
1004
1005
1005
### Legacy options as properties
1006
1006
1007
1007
Before Commander 7, the option values were stored as properties on the command.
1008
-
This was convenient to code but the downside was possible clashes with
1008
+
This was convenient to code, but the downside was possible clashes with
1009
1009
existing properties of `Command`. You can revert to the old behaviour to run unmodified legacy code by using `.storeOptionsAsProperties()`.
1010
1010
1011
1011
```js
@@ -1029,7 +1029,7 @@ See [commander-js/extra-typings](https://github.com/commander-js/extra-typings)
1029
1029
import { Command } from '@commander-js/extra-typings';
1030
1030
```
1031
1031
1032
-
ts-node: If you use `ts-node` and stand-alone executable subcommands written as `.ts` files, you need to call your program through node to get the subcommands called correctly. e.g.
1032
+
ts-node: If you use `ts-node` and stand-alone executable subcommands written as `.ts` files, you need to call your program through node to get the subcommands called correctly. e.g.
1033
1033
1034
1034
```sh
1035
1035
node -r ts-node/register pm.ts
@@ -1059,14 +1059,14 @@ You can enable `--harmony` option in two ways:
1059
1059
1060
1060
An executable subcommand is launched as a separate child process.
1061
1061
1062
-
If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al,
1062
+
If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al.,
1063
1063
the inspector port is incremented by 1 for the spawned subcommand.
1064
1064
1065
1065
If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your launch.json configuration.
1066
1066
1067
1067
### npm run-script
1068
1068
1069
-
By default when you call your program using run-script, `npm` will parse any options on the command-line and they will not reach your program. Use
1069
+
By default, when you call your program using run-script, `npm` will parse any options on the command-line and they will not reach your program. Use
1070
1070
`--` to stop the npm option parsing and pass through all the arguments.
1071
1071
1072
1072
The synopsis for [npm run-script](https://docs.npmjs.com/cli/v9/commands/npm-run-script) explicitly shows the `--` for this reason:
By default Commander calls `process.exit` when it detects errors, or after displaying the help or version. You can override
1092
+
By default, Commander calls `process.exit` when it detects errors, or after displaying the help or version. You can override
1093
1093
this behaviour and optionally supply a callback. The default override throws a `CommanderError`.
1094
1094
1095
1095
The override callback is passed a `CommanderError` with properties `exitCode` number, `code` string, and `message`. The default override behaviour is to throw the error, except for async handling of executable subcommand completion which carries on. The normal display of error messages or version or help
@@ -1105,7 +1105,7 @@ try {
1105
1105
}
1106
1106
```
1107
1107
1108
-
By default Commander is configured for a command-line application and writes to stdout and stderr.
1108
+
By default, Commander is configured for a command-line application and writes to stdout and stderr.
1109
1109
You can modify this behaviour for custom applications. In addition, you can modify the display of error messages.
1110
1110
1111
1111
Example file: [configure-output.js](./examples/configure-output.js)
0 commit comments