You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good find, thanks for reporting it!
Looks like declaration order only works when all options are annotated fields, but the order gets mixed up when annotated methods come into play.
The best way to solve this is to let application authors explicitly specify the order. Perhaps with an index attribute, like this:
@Option(names = “-x”, index = 2) int x;
@Option(names = “-y”, index = 0) int y;
@Option(names = “-z”, index = 1) int z;
I’m open to other suggestions, including a better name than index
With
@Command(sortOptions = false)
the following option definitions don't display in their declaration order:The help output:
Additionally, the following declaration seems to have unpredictable order -- it varies run to run.
First run help:
Second run:
This is with version: 3.6.1
The text was updated successfully, but these errors were encountered: