Skip to content
Myr

custom-help-description

This file

Path

examples/custom-help-description

25 lines · 756 bytes

Last changed by

Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36

History of this file

Take it

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

Tidy up example now check for required command arguments (#1320)John Geebefore adoptionf47bdf5

lines 1–11why, one step back
1#!/usr/bin/env node
23// This example shows changing the flags and description for the help option.45// const { Command } = require('commander'); // (normal include)6const { Command } = require('../'); // include commander in git clone of commander repo7const program = new Command();89program10 .helpOption('-c, --HELP', 'custom help message')11 .option('-s, --sessions', 'add session support')

Tidy up some old examples (#1604)John Geebefore adoptionc1472bc

line 12why, one step back
12 .option('-t, --template <engine>', 'specify template engine', 'jade');

Tidy up example now check for required command arguments (#1320)John Geebefore adoptionf47bdf5

lines 13–16why, one step back
13
14program15 .command('child')16 .option('--gender', 'specific gender of child')

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

line 17why, one step back
17 .action((options) => {

Tidy up example now check for required command arguments (#1320)John Geebefore adoptionf47bdf5

lines 18–21why, one step back
18 console.log('Childsubcommand...');
19 });2021program.parse(process.argv);

Tidy up some old examples (#1604)John Geebefore adoptionc1472bc

lines 22–23why, one step back
22
23// Try the following:

Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36

lines 24–25why, one step back
24// node custom-help-description -c
25// node custom-help-description child --HELP