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

CommandLine.setSeparator() is ignored when generating usage text. #184

Closed
defnull opened this issue Sep 15, 2017 · 4 comments
Closed

CommandLine.setSeparator() is ignored when generating usage text. #184

defnull opened this issue Sep 15, 2017 · 4 comments

Comments

@defnull
Copy link

defnull commented Sep 15, 2017

Title says it all. A call to cmd.usage(system.err) will print the default or annotated separator and ignores the value set by cmd.setSeparator("XXX").

@remkop
Copy link
Owner

remkop commented Sep 15, 2017

Thanks for looking at picocli.

You are correct. This behaviour is documented in the user manual.
Please see http://picocli.info/#_option_parameter_separators and http://picocli.info/#_custom_separators

Basically, the setSeparator is for the parser only, not for the usage help message.
Declaratively setting a separator via annotations like @Command(separator = ":") impacts both the usage help message and the parser.

The idea was to allow users to separately control the usage help and the parser separator.

@remkop
Copy link
Owner

remkop commented Sep 16, 2017

I realize now that this could be confusing, but on the other hand I would like to support allowing users to separately control the usage help and the parser separator.

I just saw that the javadoc on CommandLine.setSeparator is not very explicit about this. I will improve the javadoc.

I hope that will be sufficient, what do you think?

remkop added a commit that referenced this issue Sep 17, 2017
…ffects parsing only and link to the `@Command` `separator` annotation attribute.
@remkop remkop added this to the 1.1.0 milestone Sep 17, 2017
@remkop
Copy link
Owner

remkop commented Sep 17, 2017

Updated the javadoc.
Closing this issue; please reopen if more work is required.

@remkop
Copy link
Owner

remkop commented Oct 5, 2017

I have come to my senses after realizing I could not think of any scenario where it would be useful for users to have a different separator in the parser and the usage help. The current behaviour is just confusing.

I will make changes such that the separator set programmatically via CommandLine.setSeparator will be reflected in the usage help message. If different separator values are specified declaratively (in @Command(separator="xxx") and programmatically, the programmatically set value will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants