Comparing version 0.0.5 to 0.0.6
@@ -157,10 +157,8 @@ 'use strict'; | ||
function buildOptionsFromParametersAndSpec(action, optionsSpec) { | ||
// Build options from functions parameters and merge with options spec | ||
return getParametersNames(action).map(parameter => { | ||
const parameters = inspectParameters(action) || []; | ||
const optionsFromParameters = parameters.map(({ parameter, isRestParameter }) => { | ||
const option = { name: parameter }; | ||
const [, variadic] = parameter.match(/^\.{3}(.*)/) || []; | ||
if (variadic) { | ||
option.name = variadic; | ||
option.variadic = true; | ||
if (isRestParameter) { | ||
option.variadic = true; | ||
} | ||
@@ -171,2 +169,4 @@ | ||
}); | ||
return optionsFromParameters; | ||
} | ||
@@ -173,0 +173,0 @@ |
{ | ||
"name": "cliss", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "CLI Simple, Stupid. Automatic discovery of parameters names. Provides an easy and minimal setup by passing in only a function reference without the need of declaring all expected options names or create a help section by hand. Support to sync / async. Support to subcommands down to N levels.", | ||
@@ -12,8 +12,8 @@ "main": "./lib/cliss.js", | ||
"keywords": [ | ||
"cli", | ||
"command-line interface", | ||
"command line", | ||
"async", | ||
"minimal", | ||
"simple" | ||
"cli", | ||
"command-line interface", | ||
"command line", | ||
"async", | ||
"minimal", | ||
"simple" | ||
], | ||
@@ -28,4 +28,4 @@ "repository": { | ||
"get-stdin": "^5.0.1", | ||
"inspect-parameters-declaration": "0.0.9", | ||
"object-to-arguments": "0.0.8", | ||
"inspect-parameters-declaration": "^0.1.0", | ||
"object-to-arguments": "^0.1.0", | ||
"pipe-functions": "^1.3.0", | ||
@@ -32,0 +32,0 @@ "strip-ansi": "^4.0.0", |
@@ -49,2 +49,16 @@ 'use strict'; | ||
}] | ||
}, | ||
{ | ||
name: 'nested-command-promise-async', | ||
action: async (...args) => { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => resolve('promise resolved'), 1500); | ||
}); | ||
} | ||
}, { | ||
name: 'nested-command-variadic-async', | ||
action: async (...args) => { | ||
return args.reduce((result, v) => result += v); | ||
} | ||
}] | ||
@@ -51,0 +65,0 @@ }; |
@@ -19,2 +19,4 @@ 'use strict'; | ||
nested-command-set-with-action | ||
nested-command-promise-async | ||
nested-command-variadic-async | ||
`; | ||
@@ -21,0 +23,0 @@ |
Sorry, the diff of this file is not supported yet
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
36226
665
+ Addedcliss@0.0.2(transitive)
+ Addedfind-up@2.1.0(transitive)
+ Addedfor-each-property@0.0.4(transitive)
+ Addedfor-each-property-deep@0.0.3(transitive)
+ Addedget-prototype-chain@1.0.1(transitive)
+ Addedinspect-function@0.3.4(transitive)
+ Addedinspect-parameters-declaration@0.0.80.1.0(transitive)
+ Addedinspect-property@0.0.6(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedmagicli@0.0.8(transitive)
+ Addedobject-to-arguments@0.1.0(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedstringify-parameters@0.0.7(transitive)
Updatedobject-to-arguments@^0.1.0