-
Notifications
You must be signed in to change notification settings - Fork 422
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
Setter method annotated by @Option with default value not been invoked when reusing it #2149
Comments
Hi, sorry for the late response. |
Thank you for raising this. It looks like you have found a bug. For the input It looks like the bug is due to the implementation of The bug means that picocli thinks that the |
Fixed in main. Thank you for raising this! |
Behavior: Setter method annotated by @option with default value not been invoked when reusing it(By saving reusing, I leveraged
@Mixin
).For example:
I have a
@Mixin
class has bunch optionsI reused this options in other commands(in parents and subcommands as global options, I referred example: https://picocli.info/#_use_case_configure_log_level_with_a_global_option)
But found the behavior that when I define the options, the parent command(
parent/child
are relevant to the mixee command level) 's@Mixin
instance's option will not be invoked at all.For example, I have command A(
toplevel
), B(subCommand
), C(subsubCommand
), all of them has declare d@Mixin InputOptions inputOptions
.Cases:
A B -e XX C
,setEnv
inInputOptions
of A is not called at all, but C'sInputOptions
setEnv
in called.A B C -e XX
,setEnv
ofInputOptions
in both A and B is not called at all.Worth to notice,
setRegion
has been called in allInputOptions
instances in both 2 cases above.Is this some misbehaving in picocli? I was expecting in any cases, the setters method should be called in all
InputOptions
options. Thus the default value can be set for the options.The text was updated successfully, but these errors were encountered: