@@ -135,8 +135,8 @@ class Command extends EventEmitter {
135
135
* .command('stop [service]', 'stop named service, or all if no name supplied');
136
136
*
137
137
* @param {string } nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
138
- * @param {(Object| string) } [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
139
- * @param {Object } [execOpts] - configuration options (for executable)
138
+ * @param {(object | string) } [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
139
+ * @param {object } [execOpts] - configuration options (for executable)
140
140
* @return {Command } returns new command for action handler, or `this` for executable command
141
141
*/
142
142
@@ -196,8 +196,8 @@ class Command extends EventEmitter {
196
196
* You can customise the help by overriding Help properties using configureHelp(),
197
197
* or with a subclass of Help by overriding createHelp().
198
198
*
199
- * @param {Object } [configuration] - configuration options
200
- * @return {(Command|Object ) } `this` command for chaining, or stored configuration
199
+ * @param {object } [configuration] - configuration options
200
+ * @return {(Command | object ) } `this` command for chaining, or stored configuration
201
201
*/
202
202
203
203
configureHelp ( configuration ) {
@@ -222,8 +222,8 @@ class Command extends EventEmitter {
222
222
* // functions based on what is being written out
223
223
* outputError(str, write) // used for displaying errors, and not used for displaying help
224
224
*
225
- * @param {Object } [configuration] - configuration options
226
- * @return {(Command|Object ) } `this` command for chaining, or stored configuration
225
+ * @param {object } [configuration] - configuration options
226
+ * @return {(Command | object ) } `this` command for chaining, or stored configuration
227
227
*/
228
228
229
229
configureOutput ( configuration ) {
@@ -262,7 +262,7 @@ class Command extends EventEmitter {
262
262
* See .command() for creating an attached subcommand which inherits settings from its parent.
263
263
*
264
264
* @param {Command } cmd - new subcommand
265
- * @param {Object } [opts] - configuration options
265
+ * @param {object } [opts] - configuration options
266
266
* @return {Command } `this` command for chaining
267
267
*/
268
268
@@ -587,7 +587,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
587
587
* Register option if no conflicts found, or throw on conflict.
588
588
*
589
589
* @param {Option } option
590
- * @api private
590
+ * @private
591
591
*/
592
592
593
593
_registerOption ( option ) {
@@ -611,7 +611,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
611
611
* Register command if no conflicts found, or throw on conflict.
612
612
*
613
613
* @param {Command } command
614
- * @api private
614
+ * @private
615
615
*/
616
616
617
617
_registerCommand ( command ) {
@@ -707,6 +707,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
707
707
/**
708
708
* Internal implementation shared by .option() and .requiredOption()
709
709
*
710
+ * @return {Command } `this` command for chaining
710
711
* @private
711
712
*/
712
713
_optionEx ( config , flags , description , fn , defaultValue ) {
@@ -791,7 +792,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
791
792
* program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour
792
793
* program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
793
794
*
794
- * @param {boolean } [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag.
795
+ * @param {boolean } [combine] - if `true` or omitted, an optional value can be specified directly after the flag.
796
+ * @return {Command } `this` command for chaining
795
797
*/
796
798
combineFlagAndOptionalValue ( combine = true ) {
797
799
this . _combineFlagAndOptionalValue = ! ! combine ;
@@ -801,8 +803,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
801
803
/**
802
804
* Allow unknown options on the command line.
803
805
*
804
- * @param {boolean } [allowUnknown=true ] - if `true` or omitted, no error will be thrown
805
- * for unknown options.
806
+ * @param {boolean } [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options.
807
+ * @return { Command } `this` command for chaining
806
808
*/
807
809
allowUnknownOption ( allowUnknown = true ) {
808
810
this . _allowUnknownOption = ! ! allowUnknown ;
@@ -812,8 +814,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
812
814
/**
813
815
* Allow excess command-arguments on the command line. Pass false to make excess arguments an error.
814
816
*
815
- * @param {boolean } [allowExcess=true ] - if `true` or omitted, no error will be thrown
816
- * for excess arguments.
817
+ * @param {boolean } [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments.
818
+ * @return { Command } `this` command for chaining
817
819
*/
818
820
allowExcessArguments ( allowExcess = true ) {
819
821
this . _allowExcessArguments = ! ! allowExcess ;
@@ -825,7 +827,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
825
827
* subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.
826
828
* The default behaviour is non-positional and global options may appear anywhere on the command line.
827
829
*
828
- * @param {boolean } [positional=true]
830
+ * @param {boolean } [positional]
831
+ * @return {Command } `this` command for chaining
829
832
*/
830
833
enablePositionalOptions ( positional = true ) {
831
834
this . _enablePositionalOptions = ! ! positional ;
@@ -838,8 +841,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
838
841
* positional options to have been enabled on the program (parent commands).
839
842
* The default behaviour is non-positional and options may appear before or after command-arguments.
840
843
*
841
- * @param {boolean } [passThrough=true]
842
- * for unknown options.
844
+ * @param {boolean } [passThrough] for unknown options.
845
+ * @return { Command } `this` command for chaining
843
846
*/
844
847
passThroughOptions ( passThrough = true ) {
845
848
this . _passThroughOptions = ! ! passThrough ;
@@ -888,7 +891,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
888
891
* Retrieve option value.
889
892
*
890
893
* @param {string } key
891
- * @return {Object } value
894
+ * @return {object } value
892
895
*/
893
896
894
897
getOptionValue ( key ) {
@@ -902,7 +905,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
902
905
* Store option value.
903
906
*
904
907
* @param {string } key
905
- * @param {Object } value
908
+ * @param {object } value
906
909
* @return {Command } `this` command for chaining
907
910
*/
908
911
@@ -914,7 +917,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
914
917
* Store option value and where the value came from.
915
918
*
916
919
* @param {string } key
917
- * @param {Object } value
920
+ * @param {object } value
918
921
* @param {string } source - expected values are default/config/env/cli/implied
919
922
* @return {Command } `this` command for chaining
920
923
*/
@@ -1050,9 +1053,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1050
1053
* program.parse(process.argv); // assume argv[0] is app and argv[1] is script
1051
1054
* program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
1052
1055
*
1053
- * @param {string[] } [argv]
1054
- * @param {object } [parseOptions]
1055
- * @param {string } parseOptions.from - one of 'node', 'user', 'electron'
1056
+ * @param {string[] } [argv] - optional, defaults to process.argv
1057
+ * @param {object } [parseOptions] - optionally specify style of options with from: node/user/electron
1058
+ * @param {string } [ parseOptions.from] - where the args are from: 'node', 'user', 'electron'
1056
1059
* @return {Command } `this` command for chaining
1057
1060
*/
1058
1061
@@ -1080,7 +1083,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1080
1083
*
1081
1084
* @param {string[] } [argv]
1082
1085
* @param {object } [parseOptions]
1083
- * @param {string } parseOptions.from - one of 'node', 'user', 'electron'
1086
+ * @param {string } parseOptions.from - where the args are from: 'node', 'user', 'electron'
1084
1087
* @return {Promise }
1085
1088
*/
1086
1089
@@ -1186,6 +1189,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1186
1189
signals . forEach ( ( signal ) => {
1187
1190
process . on ( signal , ( ) => {
1188
1191
if ( proc . killed === false && proc . exitCode === null ) {
1192
+ // @ts -ignore because signals not typed to known strings
1189
1193
proc . kill ( signal ) ;
1190
1194
}
1191
1195
} ) ;
@@ -1538,6 +1542,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1538
1542
* Find matching command.
1539
1543
*
1540
1544
* @private
1545
+ * @return {Command | undefined }
1541
1546
*/
1542
1547
_findCommand ( name ) {
1543
1548
if ( ! name ) return undefined ;
@@ -1551,7 +1556,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1551
1556
*
1552
1557
* @param {string } arg
1553
1558
* @return {Option }
1554
- * @package internal use only
1559
+ * @package
1555
1560
*/
1556
1561
1557
1562
_findOption ( arg ) {
@@ -1766,7 +1771,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1766
1771
/**
1767
1772
* Return an object containing local option values as key-value pairs.
1768
1773
*
1769
- * @return {Object }
1774
+ * @return {object }
1770
1775
*/
1771
1776
opts ( ) {
1772
1777
if ( this . _storeOptionsAsProperties ) {
@@ -1788,7 +1793,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1788
1793
/**
1789
1794
* Return an object containing merged local and global option values as key-value pairs.
1790
1795
*
1791
- * @return {Object }
1796
+ * @return {object }
1792
1797
*/
1793
1798
optsWithGlobals ( ) {
1794
1799
// globals overwrite locals
@@ -1802,7 +1807,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1802
1807
* Display error message and exit (or call exitOverride).
1803
1808
*
1804
1809
* @param {string } message
1805
- * @param {Object } [errorOptions]
1810
+ * @param {object } [errorOptions]
1806
1811
* @param {string } [errorOptions.code] - an id string representing the error
1807
1812
* @param {number } [errorOptions.exitCode] - used with process.exit
1808
1813
*/
@@ -2081,7 +2086,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2081
2086
* Set the description.
2082
2087
*
2083
2088
* @param {string } [str]
2084
- * @param {Object } [argsDescription]
2089
+ * @param {object } [argsDescription]
2085
2090
* @return {(string|Command) }
2086
2091
*/
2087
2092
description ( str , argsDescription ) {
@@ -2355,7 +2360,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2355
2360
* Returns null if has been disabled with .helpOption(false).
2356
2361
*
2357
2362
* @returns {(Option | null) } the help option
2358
- * @package internal use only
2363
+ * @package
2359
2364
*/
2360
2365
_getHelpOption ( ) {
2361
2366
// Lazy create help option on demand.
0 commit comments