@@ -52,7 +52,7 @@ class Command extends EventEmitter {
52
52
this . _enablePositionalOptions = false ;
53
53
this . _passThroughOptions = false ;
54
54
this . _lifeCycleHooks = { } ; // a hash of arrays
55
- /** @type {boolean | string } */
55
+ /** @type {( boolean | string) } */
56
56
this . _showHelpAfterError = false ;
57
57
this . _showSuggestionAfterError = true ;
58
58
@@ -141,7 +141,7 @@ class Command extends EventEmitter {
141
141
* .command('stop [service]', 'stop named service, or all if no name supplied');
142
142
*
143
143
* @param {string } nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
144
- * @param {Object|string } [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
144
+ * @param {( Object|string) } [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
145
145
* @param {Object } [execOpts] - configuration options (for executable)
146
146
* @return {Command } returns new command for action handler, or `this` for executable command
147
147
*/
@@ -203,7 +203,7 @@ class Command extends EventEmitter {
203
203
* or with a subclass of Help by overriding createHelp().
204
204
*
205
205
* @param {Object } [configuration] - configuration options
206
- * @return {Command|Object } `this` command for chaining, or stored configuration
206
+ * @return {( Command|Object) } `this` command for chaining, or stored configuration
207
207
*/
208
208
209
209
configureHelp ( configuration ) {
@@ -229,7 +229,7 @@ class Command extends EventEmitter {
229
229
* outputError(str, write) // used for displaying errors, and not used for displaying help
230
230
*
231
231
* @param {Object } [configuration] - configuration options
232
- * @return {Command|Object } `this` command for chaining, or stored configuration
232
+ * @return {( Command|Object) } `this` command for chaining, or stored configuration
233
233
*/
234
234
235
235
configureOutput ( configuration ) {
@@ -242,7 +242,7 @@ class Command extends EventEmitter {
242
242
/**
243
243
* Display the help or a custom message after an error occurs.
244
244
*
245
- * @param {boolean|string } [displayHelp]
245
+ * @param {( boolean|string) } [displayHelp]
246
246
* @return {Command } `this` command for chaining
247
247
*/
248
248
showHelpAfterError ( displayHelp = true ) {
@@ -316,7 +316,7 @@ class Command extends EventEmitter {
316
316
*
317
317
* @param {string } name
318
318
* @param {string } [description]
319
- * @param {Function|* } [fn] - custom argument processing function
319
+ * @param {( Function|*) } [fn] - custom argument processing function
320
320
* @param {* } [defaultValue]
321
321
* @return {Command } `this` command for chaining
322
322
*/
@@ -517,7 +517,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
517
517
/**
518
518
* Wrap parseArgs to catch 'commander.invalidArgument'.
519
519
*
520
- * @param {Option | Argument } target
520
+ * @param {( Option | Argument) } target
521
521
* @param {string } value
522
522
* @param {* } previous
523
523
* @param {string } invalidArgumentMessage
@@ -691,7 +691,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
691
691
*
692
692
* @param {string } flags
693
693
* @param {string } [description]
694
- * @param {Function|* } [parseArg] - custom option processing function or default value
694
+ * @param {( Function|*) } [parseArg] - custom option processing function or default value
695
695
* @param {* } [defaultValue]
696
696
* @return {Command } `this` command for chaining
697
697
*/
@@ -708,7 +708,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
708
708
*
709
709
* @param {string } flags
710
710
* @param {string } [description]
711
- * @param {Function|* } [parseArg] - custom option processing function or default value
711
+ * @param {( Function|*) } [parseArg] - custom option processing function or default value
712
712
* @param {* } [defaultValue]
713
713
* @return {Command } `this` command for chaining
714
714
*/
@@ -725,7 +725,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
725
725
* program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour
726
726
* program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
727
727
*
728
- * @param {Boolean } [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag.
728
+ * @param {boolean } [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag.
729
729
*/
730
730
combineFlagAndOptionalValue ( combine = true ) {
731
731
this . _combineFlagAndOptionalValue = ! ! combine ;
@@ -735,7 +735,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
735
735
/**
736
736
* Allow unknown options on the command line.
737
737
*
738
- * @param {Boolean } [allowUnknown=true] - if `true` or omitted, no error will be thrown
738
+ * @param {boolean } [allowUnknown=true] - if `true` or omitted, no error will be thrown
739
739
* for unknown options.
740
740
*/
741
741
allowUnknownOption ( allowUnknown = true ) {
@@ -746,7 +746,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
746
746
/**
747
747
* Allow excess command-arguments on the command line. Pass false to make excess arguments an error.
748
748
*
749
- * @param {Boolean } [allowExcess=true] - if `true` or omitted, no error will be thrown
749
+ * @param {boolean } [allowExcess=true] - if `true` or omitted, no error will be thrown
750
750
* for excess arguments.
751
751
*/
752
752
allowExcessArguments ( allowExcess = true ) {
@@ -759,7 +759,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
759
759
* subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.
760
760
* The default behaviour is non-positional and global options may appear anywhere on the command line.
761
761
*
762
- * @param {Boolean } [positional=true]
762
+ * @param {boolean } [positional=true]
763
763
*/
764
764
enablePositionalOptions ( positional = true ) {
765
765
this . _enablePositionalOptions = ! ! positional ;
@@ -772,7 +772,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
772
772
* positional options to have been enabled on the program (parent commands).
773
773
* The default behaviour is non-positional and options may appear before or after command-arguments.
774
774
*
775
- * @param {Boolean } [passThrough=true]
775
+ * @param {boolean } [passThrough=true]
776
776
* for unknown options.
777
777
*/
778
778
passThroughOptions ( passThrough = true ) {
@@ -1229,9 +1229,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1229
1229
/**
1230
1230
* Once we have a promise we chain, but call synchronously until then.
1231
1231
*
1232
- * @param {Promise|undefined } promise
1232
+ * @param {( Promise|undefined) } promise
1233
1233
* @param {Function } fn
1234
- * @return {Promise|undefined }
1234
+ * @return {( Promise|undefined) }
1235
1235
* @private
1236
1236
*/
1237
1237
@@ -1247,9 +1247,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1247
1247
1248
1248
/**
1249
1249
*
1250
- * @param {Promise|undefined } promise
1250
+ * @param {( Promise|undefined) } promise
1251
1251
* @param {string } event
1252
- * @return {Promise|undefined }
1252
+ * @return {( Promise|undefined) }
1253
1253
* @private
1254
1254
*/
1255
1255
@@ -1278,10 +1278,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1278
1278
1279
1279
/**
1280
1280
*
1281
- * @param {Promise|undefined } promise
1281
+ * @param {( Promise|undefined) } promise
1282
1282
* @param {Command } subCommand
1283
1283
* @param {string } event
1284
- * @return {Promise|undefined }
1284
+ * @return {( Promise|undefined) }
1285
1285
* @private
1286
1286
*/
1287
1287
@@ -1477,8 +1477,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1477
1477
* sub --unknown uuu op => [sub], [--unknown uuu op]
1478
1478
* sub -- --unknown uuu op => [sub --unknown uuu op], []
1479
1479
*
1480
- * @param {String [] } argv
1481
- * @return {{operands: String [], unknown: String []} }
1480
+ * @param {string [] } argv
1481
+ * @return {{operands: string [], unknown: string []} }
1482
1482
*/
1483
1483
1484
1484
parseOptions ( argv ) {
@@ -1857,7 +1857,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1857
1857
* @param {string } [str]
1858
1858
* @param {string } [flags]
1859
1859
* @param {string } [description]
1860
- * @return {this | string | undefined } `this` command for chaining, or version string if no arguments
1860
+ * @return {( this | string | undefined) } `this` command for chaining, or version string if no arguments
1861
1861
*/
1862
1862
1863
1863
version ( str , flags , description ) {
@@ -1881,7 +1881,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1881
1881
*
1882
1882
* @param {string } [str]
1883
1883
* @param {Object } [argsDescription]
1884
- * @return {string|Command }
1884
+ * @return {( string|Command) }
1885
1885
*/
1886
1886
description ( str , argsDescription ) {
1887
1887
if ( str === undefined && argsDescription === undefined ) return this . _description ;
@@ -1896,7 +1896,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1896
1896
* Set the summary. Used when listed as subcommand of parent.
1897
1897
*
1898
1898
* @param {string } [str]
1899
- * @return {string|Command }
1899
+ * @return {( string|Command) }
1900
1900
*/
1901
1901
summary ( str ) {
1902
1902
if ( str === undefined ) return this . _summary ;
@@ -1910,7 +1910,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1910
1910
* You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.
1911
1911
*
1912
1912
* @param {string } [alias]
1913
- * @return {string|Command }
1913
+ * @return {( string|Command) }
1914
1914
*/
1915
1915
1916
1916
alias ( alias ) {
@@ -1941,7 +1941,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1941
1941
* Only the first alias is shown in the auto-generated help.
1942
1942
*
1943
1943
* @param {string[] } [aliases]
1944
- * @return {string[]|Command }
1944
+ * @return {( string[]|Command) }
1945
1945
*/
1946
1946
1947
1947
aliases ( aliases ) {
@@ -1956,7 +1956,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1956
1956
* Set / get the command usage `str`.
1957
1957
*
1958
1958
* @param {string } [str]
1959
- * @return {String |Command }
1959
+ * @return {(string |Command) }
1960
1960
*/
1961
1961
1962
1962
usage ( str ) {
@@ -1981,7 +1981,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1981
1981
* Get or set the name of the command.
1982
1982
*
1983
1983
* @param {string } [str]
1984
- * @return {string|Command }
1984
+ * @return {( string|Command) }
1985
1985
*/
1986
1986
1987
1987
name ( str ) {
@@ -2018,7 +2018,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2018
2018
* program.executableDir('subcommands');
2019
2019
*
2020
2020
* @param {string } [path]
2021
- * @return {string|null|Command }
2021
+ * @return {( string|null|Command) }
2022
2022
*/
2023
2023
2024
2024
executableDir ( path ) {
@@ -2100,7 +2100,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2100
2100
* flags and help description for your command. Pass in false to
2101
2101
* disable the built-in help option.
2102
2102
*
2103
- * @param {string | boolean } [flags]
2103
+ * @param {( string | boolean) } [flags]
2104
2104
* @param {string } [description]
2105
2105
* @return {Command } `this` command for chaining
2106
2106
*/
@@ -2145,7 +2145,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2145
2145
* and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.
2146
2146
*
2147
2147
* @param {string } position - before or after built-in help
2148
- * @param {string | Function } text - string to add, or a function returning a string
2148
+ * @param {( string | Function) } text - string to add, or a function returning a string
2149
2149
* @return {Command } `this` command for chaining
2150
2150
*/
2151
2151
addHelpText ( position , text ) {
0 commit comments