Map option problem when value contains '=' separator (was: How to quote / escape option values)
See original GitHub issueI would like to pass a map of options into my application like:
-p AppOptions="-Dspring.profiles.active=test -Dspring.mail.host=smtp.mailtrap.io"
picocli seems to get confused by the equals sign in the value. My class:
public class MyCommand implements Callable<Object> {
@Option(names = {"-p", "--parameter"})
@Getter
Map<String, String> parameters;
public static void main(String[] args) throws Exception {
Object result = CommandLine.call(new MyCommand(), System.out, args);
System.exit(result != null ? 0 : 1);
}
@Override
public Object call() throws Exception {
System.out.println(this.parameters.get("AppOptions"));
return new Object();
}
}
I expect it to output the entire value, but I’m only getting -Dspring.profiles.active
. How can I escape the value correctly?
I don’t want to make AppOptions part of my CLI directly, because I don’t control the content and users should be able to pass in an arbitary set of parameters.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Can someone explain me "TextQualifierEscape","Delimiter ...
Problem : You need to store a value in a flat file which contains the text qualifier (single or double quotes) in its...
Read more >How to escape delimiter inside the value - Stack Overflow
I myself has used rdd with Python regex import re raw_string = r"(\\\|)" rdd_cleaned = rdd.map(lambda x: re.sub(raw_string, "", x)).
Read more >Escape "\" backslash from dataweave for csv output.
If the `,` is not escaped, it can lead to a miss-interpretation/ambiguity. Is it a separator or comma? Therefore, as suggested by others...
Read more >Spark Write DataFrame to CSV File
If you have a separator or delimiter part of your value, use the quote to set a single character used for escaping quoted...
Read more >CSV Files - Spark 3.3.1 Documentation
Property Name Default Scope
sep, read/write
encoding UTF‑8 read/write
quote " read/write
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Picocli 3.0.1 is released with the fix for this bug. Thanks again for the bug report!
Sure, I’ve created #379