configure-help.js
This file
Path
examples/configure-help.js
26 lines · 911 bytes · JavaScript
Last changed by
Link to Help class in configure-help.js and README.Raine Reverebefore adoptionee78d95
History of this fileTake it
Refactor help internals into separate interface/class (#1365)John Geebefore adoption19ae912
lines 1–7why, one step back1// const commander = require('commander'); // (normal include)2const commander = require('../'); // include commander in git clone of commander repo34const program = new commander.Command();56// This example shows a simple use of configureHelp.7// This is used as an example in the README.Link to Help class in configure-help.js and README.Raine Reverebefore adoptionee78d95
lines 8–9why, one step back8// Any method on the Help class can be overridden9// See: https://github.com/tj/commander.js/blob/master/lib/help.jsRefactor help internals into separate interface/class (#1365)John Geebefore adoption19ae912
lines 10–25why, one step back1011program.configureHelp({12 sortSubcommands: true,13 subcommandTerm: (cmd) => cmd.name() // Just show the name, instead of short usage.14});1516program.command('zebra <herd-size>', 'African equines with distinctive black-and-white striped coats');17program.command('aardvark [colour]', 'medium-sized, burrowing, nocturnal mammal');18program19 .command('beaver', 'large, semiaquatic rodent')20 .option('--pond')21 .option('--river');2223program.parse();2425// Try the following:Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36
line 26why, one step back26// node configure-help.js --help