You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With docker in mind, we have a command line API like so:
docker run
docker build
docker ps
or with Istanbul in mind:
istanbul cover
istanbul report
istanbul instrument
or git:
git merge
git rebase
git checkout
etc.
is there a methodology for creating this kind of top-level action api with dashdash?
AFAICT, you'd have to make a homegrown system from dashdash, and from what I can tell, you'd have to enforce that the first argument after docker was the action.
Right now, I have a CLI API using dashdash, but it's more akin to:
where the actions are all just booleans according my dashdash config.
Just something to discuss.
I think it would be a neat feature if dashdash could take an initialization argument to interpret the first x _args as actions. And these would be stored as a separate property on opts.
So it would be something like this:
constdashdash=require('dashdash');letopts,parser=dashdash.createParser({options: options},{actions: 1// => the first arg is interpreted as an action, and it has to appear before any options });try{opts=parser.parse(process.argv);}catch(err){// }// opts => {};// opts._args => []// opts._actions => []
The text was updated successfully, but these errors were encountered:
ORESoftware
changed the title
methodology for creating top level actions
methodology for creating top level actions à la Dockêr
Jul 1, 2017
I have a nice way of using different dashdash options for each action/subcommand, which is probably the right way to do it.
my only remaining question/problem is how to get bash completion for git/docker style actions/subcommands
@trentm do you know how to get bash completion using dashdash, the way you can get bash completion for git subcommands? when I type in git me and then hit tab, I get git merge, that's what I mean. With dashdash, I can only get completion for something like git --merge.
With docker in mind, we have a command line API like so:
or with Istanbul in mind:
or git:
etc.
is there a methodology for creating this kind of top-level action api with dashdash?
AFAICT, you'd have to make a homegrown system from dashdash, and from what I can tell, you'd have to enforce that the first argument after docker was the action.
Right now, I have a CLI API using dashdash, but it's more akin to:
where the actions are all just booleans according my dashdash config.
Just something to discuss.
I think it would be a neat feature if dashdash could take an initialization argument to interpret the first x
_args
as actions. And these would be stored as a separate property on opts.So it would be something like this:
The text was updated successfully, but these errors were encountered: