@@ -107,20 +107,19 @@ class Command extends EventEmitter {
107107 *
108108 * There are two styles of command: pay attention to where to put the description.
109109 *
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');
124123 *
125124 * @param {string } nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
126125 * @param {Object|string } [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
@@ -201,14 +200,14 @@ class Command extends EventEmitter {
201200 *
202201 * The configuration properties are all functions:
203202 *
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
212211 *
213212 * @param {Object } [configuration] - configuration options
214213 * @return {Command|Object } `this` command for chaining, or stored configuration
@@ -289,9 +288,8 @@ class Command extends EventEmitter {
289288 * indicate this with <> around the name. Put [] around the name for an optional argument.
290289 *
291290 * @example
292- *
293- * program.argument('<input-file>');
294- * program.argument('[output-file]');
291+ * program.argument('<input-file>');
292+ * program.argument('[output-file]');
295293 *
296294 * @param {string } name
297295 * @param {string } [description]
@@ -316,8 +314,7 @@ class Command extends EventEmitter {
316314 * See also .argument().
317315 *
318316 * @example
319- *
320- * program.arguments('<cmd> [env]');
317+ * program.arguments('<cmd> [env]');
321318 *
322319 * @param {string } names
323320 * @return {Command } `this` command for chaining
@@ -449,14 +446,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
449446 /**
450447 * Register callback `fn` for the command.
451448 *
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+ * });
460456 *
461457 * @param {Function } fn
462458 * @return {Command } `this` command for chaining
@@ -595,41 +591,40 @@ Expecting one of '${allowedValues.join("', '")}'`);
595591 * separated by comma, a pipe or space. The following are all valid
596592 * all will output this way when `--help` is used.
597593 *
598- * "-p, --pepper"
599- * "-p|--pepper"
600- * "-p --pepper"
601- *
602- * Examples:
594+ * "-p, --pepper"
595+ * "-p|--pepper"
596+ * "-p --pepper"
603597 *
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');
606601 *
607- * program.pepper
608- * // => undefined
602+ * program.pepper
603+ * // => undefined
609604 *
610- * --pepper
611- * program.pepper
612- * // => true
605+ * --pepper
606+ * program.pepper
607+ * // => true
613608 *
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');
616611 *
617- * program.cheese
618- * // => true
612+ * program.cheese
613+ * // => true
619614 *
620- * --no-cheese
621- * program.cheese
622- * // => false
615+ * --no-cheese
616+ * program.cheese
617+ * // => false
623618 *
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');
626621 *
627- * --chdir /tmp
628- * program.chdir
629- * // => "/tmp"
622+ * --chdir /tmp
623+ * program.chdir
624+ * // => "/tmp"
630625 *
631- * // optional argument
632- * program.option('-c, --cheese [type]', 'add cheese [marble]');
626+ * // optional argument
627+ * program.option('-c, --cheese [type]', 'add cheese [marble]');
633628 *
634629 * @param {string } flags
635630 * @param {string } [description]
@@ -662,11 +657,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
662657 /**
663658 * Alter parsing of short flags with optional values.
664659 *
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`
670664 *
671665 * @param {Boolean } [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag.
672666 */
@@ -835,11 +829,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
835829 * The default expectation is that the arguments are from node and have the application as argv[0]
836830 * and the script being run in argv[1], with user parameters after that.
837831 *
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]
843836 *
844837 * @param {string[] } [argv] - optional, defaults to process.argv
845838 * @param {Object } [parseOptions] - optionally specify style of options with from: node/user/electron
@@ -862,11 +855,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
862855 * The default expectation is that the arguments are from node and have the application as argv[0]
863856 * and the script being run in argv[1], with user parameters after that.
864857 *
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]
870862 *
871863 * @param {string[] } [argv]
872864 * @param {Object } [parseOptions]
@@ -1256,11 +1248,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
12561248 *
12571249 * Examples:
12581250 *
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], []
12641256 *
12651257 * @param {String[] } argv
12661258 * @return {{operands: String[], unknown: String[]} }
0 commit comments