-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Description
Help output for options with falsy default values don't show up.
Steps to Reproduce
Save the following script as "commander.spec.js".
#!/usr/bin/env node
var program = require('commander');
function list(val) {
return val.split(',');
}
program
.option('-s, --str [value]', 'Specify string value', String, '')
.option('-l, --list [items]', 'Specify list items', list, [])
.parse(process.argv);Make the script executable and invoke it as follows to display help.
$ chmod ugo+x commander.spec.js
$ ./commander.spec.js --helpExpected Behavior
Usage: commander.spec [options]
Options:
-s, --str [value] Specify string value (default: '')
-l, --list [items] Specify list items (default: [])
-h, --help output usage informationActual Behavior
Usage: commander.spec [options]
Options:
-s, --str [value] Specify string value (default: )
-l, --list [items] Specify list items (default: )
-h, --help output usage informationVersion Information
- OS: macOS 10.13.6 (but verified elsewhere as well)
- Shell: bash
- Node: v10.3.0
- Transpiler: N/A
Additional Information
Where
Affected releases
v2.12.0 through current (v2.17.1).
Applicable Issues
Metadata
Metadata
Assignees
Labels
No labels