possibility to set arguments
Closed this issue · 4 comments
i'm missing named arguments.
cli.parse({
log: ['l', 'Enable logging'],
},[
['filename', "does something with these files", /*required*/ true, /*list*/ true],
['logfile', "logs into this file"]
],['test', 'run']);
this should result in a help output like:
Usage:
test.js [OPTIONS] filename... [logfile]
Arguments:
filename does something with these files (required)
logfile logs into this file
Options:
-l Enable logging
-h, --help Display help and usage details
Commands:
run, test
setting list=true
for arguments should add a ...
in help and result in an array when parsed.
Sorry for the delay in getting back to you, but in the name of keeping cli simple, this isn't a feature I plan on adding.
and adding it as a plugin?
or you could add a not integrated plugin structure so some like like me can build his own cli-plugin and provide it via npm ...
if you want i can open a new issue for that.
Even adding it as a plugin would require a fairly large refactor of the way argv is parsed. cli
is primarily an options parser with some extra features on top - named arguments would be cool but it's not something I'd plan on adding unless there was enough demand for it.
👍 +1 for this feature