Changelog
2.0.0
[Backward incompatible change] This version drops official support for versions of node.js before 10.x. Dashdash 1.x supports back to node 0.10.x. I've no direct intention of breaking compat, but new changes won't be tested on older node versions. Moving to a newer node allows me to switch to a modernish node-tap for better testing.
Dev changes:
Changelog
1.14.1
[issue #30] Change the output used by dashdash's Bash completion support to indicate "there are no completions for this argument" to cope with different sorting rules on different Bash/platforms. For example:
$ triton -v -p test2 package get <TAB> # before
##-no -tritonpackage- completions-##
$ triton -v -p test2 package get <TAB> # after
##-no-completion- -results-##
Changelog
1.14.0
New synopsisFromOpt(<option spec>)
function. This will be used by
node-cmdln to put together a synopsis
of options for a command. Some examples:
> synopsisFromOpt({names: ['help', 'h'], type: 'bool'});
'[ --help | -h ]'
> synopsisFromOpt({name: 'file', type: 'string', helpArg: 'FILE'});
'[ --file=FILE ]'
Changelog
1.13.1
bashCompletionSpecFromOptions
breaks on an options array with
an empty-string group.Changelog
1.13.0
Update assert-plus dep to 1.x to get recent fixes (particularly for
assert.optional*
).
Drop testing (and official support in packages.json#engines) for node 0.8.x.
Add testing against node 5.x and 4.x with make testall
.
[pull #16] Change the positiveInteger
type to NOT accept zero (0).
For those who might need the old behaviour, see
"examples/custom-option-intGteZero.js". (By Dave Pacheco.)
Changelog
1.12.2
Bash completion: Add argtypes
to specify the types of positional args.
E.g. this would allow you to have an ssh
command with argtypes = ['host', 'cmd']
for bash completion. You then have to provide Bash functions to
handle completing those types via the specExtra
arg. See
"examples/ddcompletion.js" for an example.
Bash completion: Tweak so that options or only offered as completions when
there is a leading '-'. E.g. mytool <TAB>
does NOT offer options, mytool -<TAB>
does. Without this, a tool with options would never be able to
fallback to Bash's "default" completion. For example ls <TAB>
wouldn't
result in filename completion. Now it will.
Bash completion: A workaround for not being able to explicitly have no
completion results. Because dashdash's completion uses complete -o default
,
we fallback to Bash's "default" completion (typically for filename
completion). Before this change, an attempt to explicitly say "there are
no completions that match" would unintentionally trigger filename completion.
Instead as a workaround we return:
$ ddcompletion --none <TAB> # the 'none' argtype
##-no completions-##
$ ddcompletion # a custom 'fruit' argtype
apple banana orange
$ ddcompletion z
##-no -fruit- completions-##
This is a bit of a hack, but IMO a better experience than the surprise of matching a local filename beginning with 'z', which isn't, in this case, a "fruit".
Changelog
1.12.1
<option spec>.completionType
. Add includeHidden
option to bashCompletionSpecFromOptions()
. Add support for dealing with
hidden subcmds.Changelog
1.12.0
Changelog
1.11.0
Add the arrayFlatten
boolean option to dashdash.addOptionType
used for
custom option types. This allows one to create an arrayOf...
option type
where each usage of the option can return multiple results. For example:
node mytool.js --foo a,b --foo c
We could define an option type for --foo
such that
opts.foo = ['a', 'b', 'c']
. See
"examples/custom-option-arrayOfCommaSepString.js"
for an example.