-
Notifications
You must be signed in to change notification settings - Fork 424
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
setTrimQuotes does not trim quotes #738
Comments
That looks like a bug, I will take a look as soon as I can. |
The cause is that picocli currently only strips quotes from option parameters and positional parameters, not from option names. I will fix that so that quotes are stripped from all arguments as they are processed. Just out of interest, can I ask why the option names are quoted in your use case? |
I was migrating from JCommander and noticed the break. There is no reason that I'm aware of to quote the options so I've removed it to solve my problem, however the behaviour was very unexpected. |
Agreed that it is inconsistent to not strip quotes from named options, 😁 I will fix this before the 4.0 release. Thanks for raising this! 🙏 I'm actually quite interested in use cases involving quotes. Usually the shell removes quotes before passing parameters to the application, so I was wondering how these quotes came to be there. 🤔 Any background is useful to know. |
I am also interested in general feedback on the experience migrating from JCommander. (If you have time) |
We are executing the process from Runtime.getRuntime().exec() and were quoting all the arguments, there may have been a historical reason for this but it works now in our CI environment. Generally migrating was simple, it was a drop in replacement, the only issue was the quoting. |
Another difference with JCommander is Lists are automatically created from a comma separated list of args where picocli requires splitter "," |
I have finally made some progress with this issue. The parser will now be able to correctly handle cases like this:
I also updated the user manual section on how the parser handles quotes. However, values with nested quotes like this still give it trouble:
I need to think further about how to deal with this. Ideas welcome. :-) |
@juddgaddie Your example uses |
The cases I would expect the parser to handle for this are: For For the other cases I would not expect the behaviour to be defined, if it is great.. |
Thanks for the update. I was able to find a solution that handles nested quotes if they are escaped correctly. Now writing docs. |
The text was updated successfully, but these errors were encountered: