Skip to content

Commit

Permalink
#648 added comment on some trade-offs and TBD items if we want to sup…
Browse files Browse the repository at this point in the history
…port capturing multi-char values in char[] types for non-interactive options
  • Loading branch information
remkop committed May 3, 2019
1 parent c9d53f6 commit 79073c8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/picocli/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -10739,6 +10739,10 @@ private Collection<Object> createCollection(Class<?> collectionClass, Class<?> e
}
private ITypeConverter<?> getTypeConverter(final Class<?> type, ArgSpec argSpec, int index) {
if (argSpec.converters().length > index) { return argSpec.converters()[index]; }
// https://github.com/remkop/picocli/pull/648
// consider adding ParserSpec.charArraysCanCaptureStrings() to allow non-interactive options to capture multi-char values in a char[] array
// Note that this will require special logic for char[] types in CommandLine$Interpreter.applyValuesToArrayField;
// TBD: what to do with multiple values? Append or overwrite?
if (char[].class.equals(argSpec.type()) && argSpec.interactive()) { return converterRegistry.get(char[].class); }
if (converterRegistry.containsKey(type)) { return converterRegistry.get(type); }
if (type.isEnum()) {
Expand Down

0 comments on commit 79073c8

Please sign in to comment.