-
Notifications
You must be signed in to change notification settings - Fork 431
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
Hide Java variable name #1335
Comments
One thing: the option parameter label can be controlled with the paramLabel annotation attribute. The presence of a parameter label signals to the end user that they cannot just specify an option name: it must be followed by a value. Boolean options don’t accept a variable, so the usage help for boolean options doesn’t show a parameter label. That’s why the default usage help message looks the way it does. That said, it is possible to customize this to hide the parameter label. I think there’s an example in a previous issue or one of the |
I found the example: picocli-examples/src/main/java/picocli/examples/customhelp/HideOptionParams.java Hope this helps. |
I thought that this "feature" was added to the new release and I can get rid of the custom code ;) Unfortunately, the custom code hides the default value which is set by |
Not sure what you mean by hides the default value. Can you provide a sample program that demonstrates the issue, and explain what you expected to see and what’s actually happening? |
Also note that you can embed a variable in the description to show the default value. Please see section 14.19.1 of the manual for details: https://picocli.info/#_default_value_variable |
And I can see still the variable names in the summary despite I use the additional
End users do not care about the Java variable names. This is what I would like to have:
|
Example for hiding the default value issue: This is the original code I used:
But the custom So I had to add the default value manually:
The source code available from here. |
That is almost what I had in mind, yes, I would just suggest using the @Option(names = {"-c", "--dialect"},
defaultValue = Dialect.ORACLE_VALUE,
description = "SQL dialect used during the execution of the SQL statement. "
+ "Supported SQL dialects: ${COMPLETION-CANDIDATES}.%n"
+ " Default: ${DEFAULT-VALUE}") // <---
They are not Java variable names.
Quick question: have you asked your end users? You may be surprised. 😉 Anyway, if that is what you want to do, then this is certainly possible. I added a new example HideOptionParamsFromSynopsis.java that shows how to hide the parameter label from the options in the synopsis. That should give you what you have in mind. 😉 Enjoy! |
Hi @zappee, did this solve the issue? |
Yes, thanks for the help! |
…synopsis" This reverts commit ddf40aa.
…synopsis" This reverts commit ddf40aa.
Hello,
I would like to generate Unix-style documentation but it seems that Picoli not able to generate help without Java variable names.
As you can see in your example here the Java variable name is shown:
-a, --algorithm=<algorithm>
I would like to have this:
-a, --algorithm
For me, this is a little bit weird. The end-user is not interested in seeing the internal representation of the options. She only wants to see the pure options.
Is there any option that hides the Java variable names?
The text was updated successfully, but these errors were encountered: