Multi-value option overwriting
See original GitHub issueThis code:
class Params {
@Option(names = "-a")
private String a;
@Option(names = "-b", split = ",")
private List<String> b;
}
String[] args = new String[] {
"-a", "10",
"-a", "11",
"-b", "20,21",
"-b", "22,23",
};
Params params = new Params();
new CommandLine(params)
.setOverwrittenOptionsAllowed(true)
.parse(args);
System.out.println(params.a);
System.out.println(params.b);
prints:
11
[20, 21, 22, 23]
The docs only mention single-value (-a
above) overwriting and it’s working as expected. There doesn’t seem to be a way to apply the same to multi-value (-b
above) options.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Class: MultiValue
Override the UCI configuration name to read the option value from. By default, the configuration name is inherited from the parent Map.
Read more >Work with Iterate Multivalue—ArcGIS Pro | Documentation
The Iterate Multivalue tool is used to iterate over airports, freeway exits, and recreational ... and the field values are overwritten for each...
Read more >Overwriting Definition - Investopedia
Overwriting is a strategy to sell options that are overpriced under the assumption that the options won't get exercised.
Read more >Settings bundle MultiValue default value not working
You need to ensure there isn't a previous user setting either. It overrides the default value (which is used only when the user...
Read more >Multi-Value Column Tutorial - ManagedEsent - GitHub
Starting with Windows Vista there are two new options for multi-value indexing: ... To overwrite an existing column you must set the itagSequence, ......
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
Thanks for following up.
I see your point. To be honest, until your request I had not considered applications might want to replace values instead of add to the collection for a multi-value option.
I understand you want to make this a first-class citizen of the library. I need to think about this some more.
If other people also want this feature, please leave a comment below.
Closing this issue. The current API supports the use case (via the
@Option
-annotated setter method).