https://github.com/hiroppy/cav
A supporter for making your CLI.
https://github.com/hiroppy/cav
cli
Last synced: 28 days ago
JSON representation
A supporter for making your CLI.
- Host: GitHub
- URL: https://github.com/hiroppy/cav
- Owner: hiroppy
- License: mit
- Created: 2017-04-09T14:27:25.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-17T03:11:09.000Z (almost 6 years ago)
- Last Synced: 2025-10-21T22:24:03.099Z (8 months ago)
- Topics: cli
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# cav
[](https://badge.fury.io/js/cav)
A supporter for making your CLI.
## Install
```sh
$ npm i -S cav
```
## Examples
```js
#!/usr/bin/env node
// sample-cli
const Cav = require('cav');
const packageJson = require('./package.json');
const commands = {
'deploy ' : 'Deploy to ec2.',
'migrate ': 'Migrate data.',
'-f' : '✊',
'-c, --current-state' : 'Show Current State.'
};
const cav = new Cav(commands, packageJson);
cav.start((args) => {
console.log(args)
});
```
## Parse arguments
```sh
$ sample-cli deploy japan prod -f -c ok
```
```js
cav.start((args) => {
console.log(JSON.stringify(args, null, 2));
// {
// "commands": {
// "deploy": {
// "to": "japan",
// "env": "prod"
// }
// },
// "options": {
// "f": true,
// "c": "ok"
// }
// }
});
```
## help
```
Version: 1.0.0
Usage: sample-cli
Commands:
deploy Deploy to ec2.
migrate Migrate data.
Options:
-v, --version Display version.
-h, --help Display help.
-f ✊
-c, --current-state Show Current State.
```