subcmd
v1.0.1
Published
Create CLI tools with subcommands
Downloads
3
Readme
subcmd
Create CLI tools with subcommands.
Hugely inspired by subcommand, but with a nested structure and support for usage information.
Based on minimist and cliclopts.
subcmd has a single nested structure of commands
{
name : "",
usage : "",
options : [],
command : function(args) {},
commands : []
}
It can be a single command or nested as deep as you want.
Install
npm install --save subcmd
Use
require('subcmd')({
name : 'ls',
usage : 'Usage: ls [OPTIONS]',
options : [], /* cliclopts options */
command : function(args) { /* do the ls thing */ },
commands : [{
name : 'foo',
usage : 'Usage: ls foo [OPTIONS]',
options : [],
command : function(args) { /* do the ls foo thing */ },
commands : []
}]
},{
autoHelp : true
})(process.argv.slice(2))
Options
{
autoHelp : <bool> // Print usage info and quit if -h or --help (default false)
}
Changelog
1.0.1
- Added missing deps :see_no_evil:
1.0.0
- Initial release :tada: