cav
A supporter for making your CLI.
Install
$ npm i -S cav
Examples
#!/usr/bin/env node
const Cav = require('cav');
const packageJson = require('./package.json');
const commands = {
'deploy <to> <env>' : 'Deploy to ec2.',
'migrate <from> <to> <version>': 'Migrate data.',
'-f' : '✊',
'-c, --current-state' : 'Show Current State.'
};
const cav = new Cav(commands, packageJson);
cav.start((args) => {
console.log(args)
});
Parse arguments
$ sample-cli deploy japan prod -f -c ok
cav.start((args) => {
console.log(JSON.stringify(args, null, 2));
});
help
Version: 1.0.0
Usage: sample-cli <commands> <options>
Commands:
deploy <to> <env> Deploy to ec2.
migrate <from> <to> <version> Migrate data.
Options:
-v, --version Display version.
-h, --help Display help.
-f ✊
-c, --current-state Show Current State.