-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
command with empty string should be the default command #303
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
Comments
👍 |
1 similar comment
👍 |
We don't plan to support this right now, but there's a workaround here: #338 |
May I ask why not? Would you consider accepting a pull request? Could you at least add the work around from @goloroden to the wiki? |
Here's an easy workaround for this issue: if (process.argv.length === 2) {
process.argv.push('-h')
} This causes the help text output to be the default, but you can replace |
Why doesn't the Commander support the default command? This is a basic behavior for any CLI application. |
See #742 for the currently open issue. |
I would like it if you could specify an empty command name and have that be what is invoked if none is specified.
Then:
$ example test
test
$ example foo
unknown
$ example
default
Right now I am able to replace the last command with:
But it has to go after the call to
program.parse
and it feels inelegant in comparison.The text was updated successfully, but these errors were encountered: