Index: lib/src/option.dart |
diff --git a/lib/src/option.dart b/lib/src/option.dart |
index 4045bce1e0b528b7d857631d75b1bbd38cdd49a8..440b4398510ae895dc4cbcffc2e56e31c84b9ab9 100644 |
--- a/lib/src/option.dart |
+++ b/lib/src/option.dart |
@@ -13,9 +13,10 @@ import 'dart:collection'; |
Option newOption(String name, String abbreviation, String help, |
String valueHelp, List<String> allowed, Map<String, String> allowedHelp, |
defaultValue, Function callback, OptionType type, |
- {bool negatable, bool hide: false}) { |
+ {bool negatable, bool splitCommas, bool hide: false}) { |
return new Option._(name, abbreviation, help, valueHelp, allowed, allowedHelp, |
- defaultValue, callback, type, negatable: negatable, hide: hide); |
+ defaultValue, callback, type, negatable: negatable, |
+ splitCommas: splitCommas, hide: hide); |
} |
/// A command-line option. Includes both flags and options which take a value. |
@@ -30,6 +31,7 @@ class Option { |
final Map<String, String> allowedHelp; |
final OptionType type; |
final bool negatable; |
+ final bool splitCommas; |
final bool hide; |
/// Whether the option is boolean-valued flag. |
@@ -43,13 +45,18 @@ class Option { |
Option._(this.name, this.abbreviation, this.help, this.valueHelp, |
List<String> allowed, Map<String, String> allowedHelp, this.defaultValue, |
- this.callback, this.type, {this.negatable, this.hide: false}) |
+ this.callback, OptionType type, {this.negatable, bool splitCommas, |
+ this.hide: false}) |
: this.allowed = allowed == null |
? null |
: new UnmodifiableListView(allowed), |
this.allowedHelp = allowedHelp == null |
? null |
- : new UnmodifiableMapView(allowedHelp) { |
+ : new UnmodifiableMapView(allowedHelp), |
+ this.type = type, |
+ this.splitCommas = splitCommas == null |
Bob Nystrom
2015/03/04 22:01:37
Can you add a little comment explaining this?
nweiz
2015/03/04 22:05:41
Done.
|
+ ? type == OptionType.MULTIPLE |
+ : splitCommas { |
if (name.isEmpty) { |
throw new ArgumentError('Name cannot be empty.'); |
} else if (name.startsWith('-')) { |