Changelog
1.10.0
includeDefault
in help config (similar to includeEnv
) to have a
note of an option's default value, if any, in help output.Changelog
1.9.0
addOptionType
can specify a
"default" value. See "examples/custom-option-fruit.js".Changelog
1.7.3
[issue #8] Fix parsing of a short option group when one of the
option takes an argument. For example, consider tail
with
a -f
boolean option and a -n
option that takes a number
argument. This should parse:
tail -fn5
Before this change, that would not parse correctly. It is suspected that this was introduced in version 1.4.0 (with commit 656fa8bc71c372ebddad0a7026bd71611e2ec99a).
Changelog
1.7.1
Known issues: #8
Support an option group empty string value:
...
{ group: '' },
...
to render as a blank line in option help. This can help separate loosely related sets of options without resorting to a title for option groups.
Changelog
1.7.0
Known issues: #8
[pull #7] Support for <parser>.help({helpWrap: false, ...})
option to be able
to fully control the formatting for option help (by Patrick Mooney) helpWrap: false
can also be set on individual options in the option objects, e.g.:
var options = [
{
names: ['foo'],
type: 'string',
helpWrap: false,
help: 'long help with\n newlines' +
'\n spaces\n and such\nwill render correctly'
},
...
];
Changelog
1.6.0
Known issues: #8
[pull #6] Support headings between groups of options (by Joshua M. Clulow) so that this code:
var options = [
{ group: 'Armament Options' },
{ names: [ 'weapon', 'w' ], type: 'string' },
{ group: 'General Options' },
{ names: [ 'help', 'h' ], type: 'bool' }
];
...
will give you this help output:
...
Armament Options:
-w, --weapon
General Options:
-h, --help
...
Changelog
1.5.0
Known issues: #8
Add support for adding custom option types. "examples/custom-option-duration.js" shows an example adding a "duration" option type.
$ node custom-option-duration.js -t 1h
duration: 3600000 ms
$ node custom-option-duration.js -t 1s
duration: 1000 ms
$ node custom-option-duration.js -t 5d
duration: 432000000 ms
$ node custom-option-duration.js -t bogus
custom-option-duration.js: error: arg for "-t" is not a valid duration: "bogus"
A custom option type is added via:
var dashdash = require('dashdash');
dashdash.addOptionType({
name: '...',
takesArg: true,
helpArg: '...',
parseArg: function (option, optstr, arg) {
...
}
});
[issue #4] Add date
and arrayOfDate
option types. They accept these date
formats: epoch second times (e.g. 1396031701) and ISO 8601 format:
YYYY-MM-DD[THH:MM:SS[.sss][Z]]
(e.g. "2014-03-28",
"2014-03-28T18:35:01.489Z"). See "examples/date.js" for an example usage.
$ node examples/date.js -s 2014-01-01 -e $(date +%s)
start at 2014-01-01T00:00:00.000Z
end at 2014-03-29T04:26:18.000Z
Changelog
1.4.0
Known issues: #8
[pull #2, pull #3] Add a allowUnknown: true
option on createParser
to
allow unknown options to be passed through as opts._args
instead of parsing
throwing an exception (by https://github.com/isaacs).
See 'allowUnknown' in the README for a subtle caveat.