Changelog
3.4.0
{{cmd}}
template var for subcommand help text (by Dave
Eddy).Changelog
3.3.0
<MyCLI instance>.bashCompletion()
will generate bash completions
for the MyCLI
tool. You can add, e.g., a 'completion(s)' command
to your CLI for users to run. Or you could generate completions
and distribute those with your tool.
See "examples/conan.js" for example usage.
$ alias conan="node examples/conan.js"
$ conan completion > conan.completion
$ source conan.completion
$ conan <TAB>
--help --version -v completion hear see
--verbose -h -x crush help smash
Bash completion support is mostly by <github.com/bahamas10>.
Changelog
3.2.4
MyCLI.prototype.do_frob.allowUnknownOptions = true
.
Instead of raising a usage error, unknown options to that subcommand
will be passed through in args
.Changelog
3.2.3
MyCLI.prototype.do_frob.interspersedOptions = false
to disable interspersed options (i.e. options after the first argument)
to a given command. By default cmdln allows interspersed options
for subcommands (using the node-dashdash default).Changelog
3.2.2
Don't error with:
Error: "helpSubcmds" error: unmatched command handlers found: foo, bar
if the "foo" and "bar" commands are hidden (via do_foo.hidden = true
).
Changelog
3.2.0
[pull #7] Support for hidden command aliases to allow renaming a command while preserving the old name (though not documenting it).
MyCLI.prototype.do_frob.hiddenAliases = ['ye-old-frob'];
MyCLI.prototype.do_frob.aliases = ['fr'];
By Dave Pacheco.
Changelog
3.1.0
[issue #5] Add helpSubcmds
constructor option to allow control over the
output of the "Commands:" section of top-level help. For example, this code:
helpSubcmds: [
'help',
{ group: '' },
'in-empty-group',
{ group: 'Most Excellent Commands' },
'awesome',
{ group: 'Other Commands', unmatched: true }
]
yields help output something like:
...
Commands:
help (?) Help on a specific sub-command.
in-empty-group Do in-empty-group things.
Most Excellent Commands:
awesome Do awesome things.
Other Commands:
something-else Do something-else things.
By Josh Clulow.
[issue #4] Add Cmdln.prototype.helpFromSubcmd(subcmd)
to get the help string
for the given subcommand. This can be useful for tools that want to emit usage
information as part of a usage error. E.g.:
MyCLI.prototype.do_frob = do_frob(subcmd, opts, args, cb) {
if (!opts.frobber) {
return callback(new Error('you forgot the frobber\n' +
this.helpFromSubcmd(subcmd)));
}
// ...
};
Changelog
3.0.2
Changelog
3.0.1
Allow one to override how option help is formatted for a subcmd by setting
CLI.prototype.do_<subcmd>.helpOpts = <dashdash helpOpts object>;
. See
supported helpOpts in the dashdash help config
docs.
Update to latest dashdash (1.7.1).