-
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
Options defined on parent command appear to not be assignable to values of registered subcommand names #1538
Comments
Hi @turnef, thank you for raising this! Perhaps the best way currently available to deal with this is to set a parameter consumer or a parameter preprocessor on the option. Issue #1125 has an example. I will update the section in the documentation for this to clarify that not just option names, but also subcommand names are not accepted as option values out of the box, and provide an example of how to deal with this. |
I modified this section of the manual: https://picocli.info/#_option_names_or_subcommands_as_option_values it now has Java and Kotlin examples of using a parameter processor for this use case. |
@remkop, thanks for your response. Yes, this is a duplicate of #1125, and please accept my apologies for posting it. I should have taken the time to read through the existing issues first. The custom parameter processor example you added in the documentation solves the specific problem I have quite nicely. Thanks again for your time and advice. |
@turnef no need to apologize! |
I may be making a mistake or perhaps my expectations are misguided, but it appears that in some cases single-valued type options are unable to be assigned values of registered subcommand names. The following simple example demonstrates the issue:
My expectations were that at least one of the two failures in the main method would have succeeded in assigning the Path field output to the value of subset.
Thanks in advance for any suggestions or thoughts on how I might handle this situation.
The text was updated successfully, but these errors were encountered: