-
Notifications
You must be signed in to change notification settings - Fork 92
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
fix: Error when the user puts options before the subcommand #834
Conversation
377bfe7
to
dc8c55f
Compare
dc8c55f
to
b0563cb
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #834 +/- ##
============================================
- Coverage 65.90% 65.84% -0.05%
Complexity 1514 1514
============================================
Files 223 223
Lines 6160 6165 +5
Branches 932 933 +1
============================================
Hits 4059 4059
- Misses 1562 1567 +5
Partials 539 539 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
A few comments:
- There could be options starting with
-
, it should also be handled correctly. - move the text to the resource bundle (
resources/messages/messages.properties
).
Honestly, it looks more like a hack. @yevheniyJ maybe you'll have some other ideas? |
These will be silently ignored due to a bug in picocli (crowdin#833)
b0563cb
to
e36ecaa
Compare
Addressed your review points. I of course agree it's a hack, but this error really would have saved me a lot of debugging frustrations 😅 |
First of all this fix won't help if option was passed in the middle of the command, e.g. Second point: there is just no way to detect whether or not order is correct, especially where we have root commands with subcommands and multiple arguments with their values (or array of values). The proper fix would be I guess to use inherit scopes for options https://picocli.info/#_inherited_options and bypass them from root to target subcommands. But this require extra research. |
I tried the inherited options, but this explodes in picocli because multiple classes inherit from
That being said, I don't think it's very likely the a user will pass |
It seems like if we allow to pass option in another position, then picocli won’t allow any other position. At least this is my impression. And there is no obvious fix. I think for now we won’t do anything since it’s anyway not the correct usage of our CLI and in documentation we multiple times showing how, with what commands, options, in which order, tool should be used. |
These will be silently ignored due to a bug in picocli (#833)
Does this need localization for the error message itself?