Skip to content
Myr

configure-help.js

This file

Path

examples/configure-help.js

30 lines · 803 bytes · JavaScript

Last changed by

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

History of this file

Take it

The walk stopped after 200 commits: lines older than 471ec40 point at it.

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

lines 1–2why, one step back
1import { Command } from 'commander';
2const program = new Command();

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 3–5why, one step back
3
4// This example shows a simple use of configureHelp.5// This is used as an example in the README.

Link to Help class in configure-help.js and README.Raine Reverebefore adoptionee78d95

lines 6–7why, one step back
6// Any method on the Help class can be overridden
7// See: https://github.com/tj/commander.js/blob/master/lib/help.js

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 8–10why, one step back
8
9program.configureHelp({10 sortSubcommands: true,

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 11why, one step back
11 subcommandTerm: (cmd) => cmd.name(), // Just show the name, instead of short usage.

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 12–13why, one step back
12});
13

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 14–21why, one step back
14program.command(
15 'zebra <herd-size>',16 'African equines with distinctive black-and-white striped coats',17);18program.command(19 'aardvark [colour]',20 'medium-sized, burrowing, nocturnal mammal',21);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 22–30why, one step back
22program
23 .command('beaver', 'large, semiaquatic rodent')24 .option('--pond')25 .option('--river');2627program.parse();2829// Try the following:30// node configure-help.js --help