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
Error out if unknown command #896
Conversation
Thank for a pr, unfortunately, we cannot accept it this time, as it introduces a breaking change, will we come back to it once work on v3 will be started. |
Lots of little comments from first read through:
|
See also: #941 |
I am leaving this one out of v3 as the error handling is quite subtle and fragile, and this Pull Request changed quite a lot of files. Keeping open, but no action likely in meantime. |
I would like to offer easy handling of unknown commands, because I expect most people would like it. However, there will also be people who have written fancy suggestions for misspellings, or be relying on processing themselves, so might need a way to opt-out. Changes to the error detection and handling are hard, with lots of code paths for .action and git-style executables, programs with and without .argument, default commands, et al. This PR incorrectly generates error messages when the program has Adding support for automatic detection of unknown commands is likely to be quite a big job, or require quite a bit of analysis of use cases. Or both! |
If we have commands
foo bar coo
, once you type with unknown subcommand such as:$ foo invalid
it will output error ''Error: unknown command invalid' with help info.
$ foo bar invalid
it will output error ''Error: unknown command invalid' with help info.
Tests are added.