Skip to content
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

Un deprecate the help attribute - to provide support for multiple help option #1422

Closed
kaushalkumar opened this issue Aug 31, 2021 · 5 comments
Labels
theme: usagehelp An issue or change related to the usage help message type: API 🔌
Milestone

Comments

@kaushalkumar
Copy link
Contributor

Hi - We have a scenario, where we would like to provide multiple option for help to our user. Actually, our command has a number of parameters (option + parameter). A good number of these parameters have default value or are read from a separate file. Since the parameters with default values are not very prime for our users to see, so we made those option hidden and introduced an option of "-H, --help-all-args" whose purpose is to unhide the parameters and display entire help.

This was working fine till we did not have any required option/parameter. The moment we added a command with required option/parameter, the command failed in validating required data check.

I tried to use preprocessor API (IParameterPreprocessor) to by pass the validation, but it did not work, as we have subcommands and the preprocessor API exits at top level command.

Can you please provide your input on this. Whether this is achievable in current version, if so, what shall be done to make it work. What we need to do is to unhide the options and invoke usage, if -H is passed as an argument (without any validation).

By the way, when we tried to put usageHelp=true on this new option, then we got a warning stating that multiple help option is configured.

Thanks

@remkop
Copy link
Owner

remkop commented Aug 31, 2021

Please try adding help = true to the -H option, instead of usageHelp = true.

@kaushalkumar
Copy link
Contributor Author

This works. Wonderful... thanks @remkop .
Only thing to worry about is the deprecated annotation on Option.help. Do we have any alternate mechanism to a achieve this functionality, without using deprecated APIs.

@remkop
Copy link
Owner

remkop commented Aug 31, 2021

I should take the deprecation off.
Your use case is exactly why the help attribute is still useful.

Let’s change the title of this ticket and make it about undeprecating the help attribute.

@kaushalkumar kaushalkumar changed the title Support for multiple option of help Un deprecate the help attribute - to provide support for multiple help option Sep 1, 2021
@kaushalkumar
Copy link
Contributor Author

Undeprecating will help us. I have updated the title of this ticket. Thanks

@remkop remkop closed this as completed in f7c499c Sep 2, 2021
@remkop remkop added this to the 4.6.2 milestone Sep 2, 2021
@remkop remkop added type: API 🔌 theme: usagehelp An issue or change related to the usage help message labels Sep 2, 2021
@remkop
Copy link
Owner

remkop commented Sep 2, 2021

I removed the deprecated annotation from the @Option ``help attribute and updated the javadoc.

This will be part of the next picocli release.
Thank you for raising this!

MarkoMackic pushed a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: usagehelp An issue or change related to the usage help message type: API 🔌
Projects
None yet
Development

No branches or pull requests

2 participants