diff --git a/CliFx/Services/CommandOptionConverter.cs b/CliFx/Services/CommandOptionConverter.cs index 6860487..861fe05 100644 --- a/CliFx/Services/CommandOptionConverter.cs +++ b/CliFx/Services/CommandOptionConverter.cs @@ -228,13 +228,19 @@ namespace CliFx.Services throw new CommandOptionConvertException( $"Can't convert sequence of values [{option.Values.JoinToString(", ")}] to type [{targetType}]."); } - else + else if (option.Values.Count <= 1) { // Take first value and ignore the rest - var value = option.Values.FirstOrDefault(); + var value = option.Values.SingleOrDefault(); return ConvertValue(value, targetType); } + else + { + // TODO: better exception + throw new CommandOptionConvertException( + $"Can't convert sequence of values [{option.Values.JoinToString(", ")}] to type [{targetType}]."); + } } } } \ No newline at end of file