Comparing version 0.0.1 to 0.0.2
@@ -5,2 +5,4 @@ 'use strict'; | ||
const parsedArgs = Object.keys(args).reduce((prev, current) => { | ||
// commands | ||
if (current === '_') { | ||
@@ -21,5 +23,8 @@ const argument = args[current]; | ||
prev[argument[0]] = commandOptionsList; | ||
prev.commands = Object.assign(prev.commands ||{}, { | ||
[argument[0]]: commandOptionsList | ||
}); | ||
} | ||
// options | ||
else { | ||
@@ -32,4 +37,7 @@ | ||
if (existed) prev[current] = args[current]; | ||
return prev; | ||
if (existed) { | ||
prev.options = Object.assign(prev.options || {}, { | ||
[current]: args[current] | ||
}); | ||
} | ||
} | ||
@@ -36,0 +44,0 @@ return prev; |
@@ -5,3 +5,3 @@ { | ||
"author": "(http://about-hiroppy.com) abouthiroppy <git@about-hiroppy.com>", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "MIT", | ||
@@ -18,2 +18,6 @@ "description": "", | ||
}, | ||
"repository": { | ||
"url": "git+https://github.com/abouthiroppy/cav.git", | ||
"type": "git" | ||
}, | ||
"scripts": { | ||
@@ -20,0 +24,0 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", |
# cav | ||
[![npm version](https://badge.fury.io/js/cav.svg)](https://badge.fury.io/js/cav) | ||
A supporter for making your CLI. | ||
## Install | ||
```sh | ||
$ npm i -S cav | ||
``` | ||
## Examples | ||
```js | ||
@@ -33,3 +40,15 @@ #!/usr/bin/env node | ||
cav.start((args) => { | ||
// { deploy: { to: 'japan', env: 'prod' }, f: true, c: 'ok' } | ||
console.log(JSON.stringify(args, null, 2)); | ||
// { | ||
// "commands": { | ||
// "deploy": { | ||
// "to": "japan", | ||
// "env": "prod" | ||
// } | ||
// }, | ||
// "options": { | ||
// "f": true, | ||
// "c": "ok" | ||
// } | ||
// } | ||
}); | ||
@@ -36,0 +55,0 @@ ``` |
@@ -18,5 +18,5 @@ #!/usr/bin/env node | ||
cav.start((args) => { | ||
console.log(args); | ||
console.log(JSON.stringify(args, null, 2)); | ||
}); | ||
console.log(cav.help()); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
9415
17
153
71
0