-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Unknown option gives user unfriendly error #24
Comments
After some investigation... This is technically not a bug. The current behavior is that it interprets the I'll have to think about it more to see if there's a way to deal with this use case. |
It might well be not a bug technically, but this behaviour is very surprising and unwelcome. In practice this happens when the user makes a typo in the option name, e.g. suppose your program synopsis is (and, of course, if you really wanted to create a file called like this, you should be able to use |
@vadz indeed, it's annoying. Which is why I haven't closed this :-) Addressing this is not easy because it break backwards compat. But I'm thinking that okay in this case. Just will take more thinking to minimize the impact. |
Would you be interested in a PR implementing this? I'd like to finally do something about it, because as much as I like Lyra's API, we can't tell our users never to make typos in their command lines (spoiler: it doesn't work). |
@vadz if you can think of a way to do it I'd love to have a fix for it! |
If you misspell or provide an option that doesn't have a parser, when at least one argument is present in the parser, the returned error code isn't very user friendly.
Easiest to show with an example.
Given this code
and the commandline arguments
--foo /my/project/directory
The returned error is
Unrecognized token: /my/project/directory
Expected: Parser should recognize the '--' or '-' prefix on '--foo' and give an error about the missing option.
The text was updated successfully, but these errors were encountered: