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
Default command #301
Comments
@sondr3 Hey thanks for the question! Sorry for the delayed response. Can you elaborate a bit more on what you're trying to do? Is one of the following accurate?
If the first, yargs does not have direct support for this out-of-the-box, but it should be rather simple to implement on your own (e.g. if If the second, yargs is fully synchronous, which makes it easy to run whatever code you want after args are parsed and validated via the Does this help? |
Yeah, I figured out how to do the first one on my own after a while, just thought that maybe there was a default flag or something you could add to a command or something. Thanks for the help though! |
I have the save question.
Actually, there is an ambiguity if
In this case it's not clear what But in my case
@nexdrew The problem here is to validate options that
@sondr3 Could you share your final solution? |
@th0r You bring up a good point, but I think I can come up with a workaround. I'll take a closer look later today. Also, know that my next two self-appointed tasks for yargs is to build in support for (1) command aliases and (2) specifying a default command. Once those are in place, yargs should be able to handle your use-case out of the box. Thanks for your feedback and patience. I'll get back to this soon. |
Great news and thanks for your work! |
@th0r sorry, forgot to reply, I can't even remember what it was for nor the solution I came up with. 😕 |
I think default command is a good solution, because it allows to put all logic in commands. It seemes that there're a two ways to use such thinks like yargs: Possible solutions:
|
BTW, |
land at #467 (comment) |
I've looked through most of the issues but I haven't seen anything like this, I want my command line program to run a command when you just type the name of the program. Right now it just defaults to nothing, and I haven't figured out how to make it do something without writing any commands. I thought about making a hidden default command, but I couldn't figure out how to make it run when you don't type any commands. Any help would be greatly appreciated 😄
The text was updated successfully, but these errors were encountered: