Skip to content
Myr

add `outputhelp` usage tip

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by zhiyelee · committed by zhiyelee · parent 19f115f · Browse files · 1 file+16 added−20 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−20 removed

  • other:+16 added−20 removed

1 file+16 added−20 removed

modified:Readme.md+16 added-20 removed
156 unmodified lines
157 -C, --no-cheese You do not want any cheese158159```160161## Help by default162163If you want to display help by default (e.g. if no command was provided), you can use something like;164165```166167var program = require('commander');168169program170 .version('0.0.1')171 .command('getstream [url]', 'get stream URL')172 .parse(process.argv);173174 if (!process.argv.slice(2).length) {175 program.outputHelp();176 return;177 }178```179161## Custom help162163 You can display arbitrary `-h, --help` information164 by listening for "--help". Commander will automatically
55 unmodified lines
220```221222## .outputHelp()223243 Output help information without exiting.224Output help information without exiting.225226If you want to display help by default (e.g. if no command was provided), you can use something like:227228```js229var program = require('commander');230231program232 .version('0.0.1')233 .command('getstream [url]', 'get stream URL')234 .parse(process.argv);235236 if (!process.argv.slice(2).length) {237 program.outputHelp();238 }239```240241## .help()242243 Output help information and exit immediately.244
71 unmodified lines