@@ -107,20 +107,19 @@ class Command extends EventEmitter {
107
107
*
108
108
* There are two styles of command: pay attention to where to put the description.
109
109
*
110
- * Examples:
111
- *
112
- * // Command implemented using action handler (description is supplied separately to `.command`)
113
- * program
114
- * .command('clone <source> [destination]')
115
- * .description('clone a repository into a newly created directory')
116
- * .action((source, destination) => {
117
- * console.log('clone command called');
118
- * });
119
- *
120
- * // Command implemented using separate executable file (description is second parameter to `.command`)
121
- * program
122
- * .command('start <service>', 'start named service')
123
- * .command('stop [service]', 'stop named service, or all if no name supplied');
110
+ * @example
111
+ * // Command implemented using action handler (description is supplied separately to `.command`)
112
+ * program
113
+ * .command('clone <source> [destination]')
114
+ * .description('clone a repository into a newly created directory')
115
+ * .action((source, destination) => {
116
+ * console.log('clone command called');
117
+ * });
118
+ *
119
+ * // Command implemented using separate executable file (description is second parameter to `.command`)
120
+ * program
121
+ * .command('start <service>', 'start named service')
122
+ * .command('stop [service]', 'stop named service, or all if no name supplied');
124
123
*
125
124
* @param {string } nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
126
125
* @param {Object|string } [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
@@ -201,14 +200,14 @@ class Command extends EventEmitter {
201
200
*
202
201
* The configuration properties are all functions:
203
202
*
204
- * // functions to change where being written, stdout and stderr
205
- * writeOut(str)
206
- * writeErr(str)
207
- * // matching functions to specify width for wrapping help
208
- * getOutHelpWidth()
209
- * getErrHelpWidth()
210
- * // functions based on what is being written out
211
- * outputError(str, write) // used for displaying errors, and not used for displaying help
203
+ * // functions to change where being written, stdout and stderr
204
+ * writeOut(str)
205
+ * writeErr(str)
206
+ * // matching functions to specify width for wrapping help
207
+ * getOutHelpWidth()
208
+ * getErrHelpWidth()
209
+ * // functions based on what is being written out
210
+ * outputError(str, write) // used for displaying errors, and not used for displaying help
212
211
*
213
212
* @param {Object } [configuration] - configuration options
214
213
* @return {Command|Object } `this` command for chaining, or stored configuration
@@ -289,9 +288,8 @@ class Command extends EventEmitter {
289
288
* indicate this with <> around the name. Put [] around the name for an optional argument.
290
289
*
291
290
* @example
292
- *
293
- * program.argument('<input-file>');
294
- * program.argument('[output-file]');
291
+ * program.argument('<input-file>');
292
+ * program.argument('[output-file]');
295
293
*
296
294
* @param {string } name
297
295
* @param {string } [description]
@@ -316,8 +314,7 @@ class Command extends EventEmitter {
316
314
* See also .argument().
317
315
*
318
316
* @example
319
- *
320
- * program.arguments('<cmd> [env]');
317
+ * program.arguments('<cmd> [env]');
321
318
*
322
319
* @param {string } names
323
320
* @return {Command } `this` command for chaining
@@ -449,14 +446,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
449
446
/**
450
447
* Register callback `fn` for the command.
451
448
*
452
- * Examples:
453
- *
454
- * program
455
- * .command('help')
456
- * .description('display verbose help')
457
- * .action(function() {
458
- * // output help here
459
- * });
449
+ * @example
450
+ * program
451
+ * .command('help')
452
+ * .description('display verbose help')
453
+ * .action(function() {
454
+ * // output help here
455
+ * });
460
456
*
461
457
* @param {Function } fn
462
458
* @return {Command } `this` command for chaining
@@ -595,41 +591,40 @@ Expecting one of '${allowedValues.join("', '")}'`);
595
591
* separated by comma, a pipe or space. The following are all valid
596
592
* all will output this way when `--help` is used.
597
593
*
598
- * "-p, --pepper"
599
- * "-p|--pepper"
600
- * "-p --pepper"
601
- *
602
- * Examples:
594
+ * "-p, --pepper"
595
+ * "-p|--pepper"
596
+ * "-p --pepper"
603
597
*
604
- * // simple boolean defaulting to undefined
605
- * program.option('-p, --pepper', 'add pepper');
598
+ * @example
599
+ * // simple boolean defaulting to undefined
600
+ * program.option('-p, --pepper', 'add pepper');
606
601
*
607
- * program.pepper
608
- * // => undefined
602
+ * program.pepper
603
+ * // => undefined
609
604
*
610
- * --pepper
611
- * program.pepper
612
- * // => true
605
+ * --pepper
606
+ * program.pepper
607
+ * // => true
613
608
*
614
- * // simple boolean defaulting to true (unless non-negated option is also defined)
615
- * program.option('-C, --no-cheese', 'remove cheese');
609
+ * // simple boolean defaulting to true (unless non-negated option is also defined)
610
+ * program.option('-C, --no-cheese', 'remove cheese');
616
611
*
617
- * program.cheese
618
- * // => true
612
+ * program.cheese
613
+ * // => true
619
614
*
620
- * --no-cheese
621
- * program.cheese
622
- * // => false
615
+ * --no-cheese
616
+ * program.cheese
617
+ * // => false
623
618
*
624
- * // required argument
625
- * program.option('-C, --chdir <path>', 'change the working directory');
619
+ * // required argument
620
+ * program.option('-C, --chdir <path>', 'change the working directory');
626
621
*
627
- * --chdir /tmp
628
- * program.chdir
629
- * // => "/tmp"
622
+ * --chdir /tmp
623
+ * program.chdir
624
+ * // => "/tmp"
630
625
*
631
- * // optional argument
632
- * program.option('-c, --cheese [type]', 'add cheese [marble]');
626
+ * // optional argument
627
+ * program.option('-c, --cheese [type]', 'add cheese [marble]');
633
628
*
634
629
* @param {string } flags
635
630
* @param {string } [description]
@@ -662,11 +657,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
662
657
/**
663
658
* Alter parsing of short flags with optional values.
664
659
*
665
- * Examples:
666
- *
667
- * // for `.option('-f,--flag [value]'):
668
- * .combineFlagAndOptionalValue(true) // `-f80` is treated like `--flag=80`, this is the default behaviour
669
- * .combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
660
+ * @example
661
+ * // for `.option('-f,--flag [value]'):
662
+ * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour
663
+ * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
670
664
*
671
665
* @param {Boolean } [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag.
672
666
*/
@@ -835,11 +829,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
835
829
* The default expectation is that the arguments are from node and have the application as argv[0]
836
830
* and the script being run in argv[1], with user parameters after that.
837
831
*
838
- * Examples:
839
- *
840
- * program.parse(process.argv);
841
- * program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions
842
- * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
832
+ * @example
833
+ * program.parse(process.argv);
834
+ * program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions
835
+ * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
843
836
*
844
837
* @param {string[] } [argv] - optional, defaults to process.argv
845
838
* @param {Object } [parseOptions] - optionally specify style of options with from: node/user/electron
@@ -862,11 +855,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
862
855
* The default expectation is that the arguments are from node and have the application as argv[0]
863
856
* and the script being run in argv[1], with user parameters after that.
864
857
*
865
- * Examples:
866
- *
867
- * await program.parseAsync(process.argv);
868
- * await program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions
869
- * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
858
+ * @example
859
+ * await program.parseAsync(process.argv);
860
+ * await program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions
861
+ * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
870
862
*
871
863
* @param {string[] } [argv]
872
864
* @param {Object } [parseOptions]
@@ -1256,11 +1248,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1256
1248
*
1257
1249
* Examples:
1258
1250
*
1259
- * argv => operands, unknown
1260
- * --known kkk op => [op], []
1261
- * op --known kkk => [op], []
1262
- * sub --unknown uuu op => [sub], [--unknown uuu op]
1263
- * sub -- --unknown uuu op => [sub --unknown uuu op], []
1251
+ * argv => operands, unknown
1252
+ * --known kkk op => [op], []
1253
+ * op --known kkk => [op], []
1254
+ * sub --unknown uuu op => [sub], [--unknown uuu op]
1255
+ * sub -- --unknown uuu op => [sub --unknown uuu op], []
1264
1256
*
1265
1257
* @param {String[] } argv
1266
1258
* @return {{operands: String[], unknown: String[]} }
0 commit comments