Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Default verb #490

Closed
rwatjen opened this issue Oct 12, 2017 · 2 comments
Closed

Question: Default verb #490

rwatjen opened this issue Oct 12, 2017 · 2 comments

Comments

@rwatjen
Copy link

rwatjen commented Oct 12, 2017

I have a command line tool with three verbs.
One is supposed to be used almost all the time. Is it possible to use it as default, unless one of the other verbs are specified, so e.g.
mycmd.exe --verb1optionA --verb1optionB
does the same as
mycmd.exe verb1 --verb1optionA --verb1optionB

And the user can specify verb2 or verb3 if they want to do something else?

@nemec
Copy link
Collaborator

nemec commented Oct 13, 2017

Hi @rwatjen, no that is not possible today in 2.x. If you choose to use verbs and leave one out of the arguments, parsing will return a BadVerbSelectedError. You could pop one on the front before parsing if you notice args[0] begins with a -, but it's not a great developer experience. I like the idea, though.

@rwatjen
Copy link
Author

rwatjen commented Oct 13, 2017

Thank you @nemec for the reply. I think I'll put the default verb in like you suggest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants