Index: pkg/args/lib/src/options.dart |
diff --git a/pkg/args/lib/src/options.dart b/pkg/args/lib/src/options.dart |
index 00c0ad8dc22b2f190b418b6436846cc054a4c139..5f1f48405ce04c627881789875c71c731cd641ff 100644 |
--- a/pkg/args/lib/src/options.dart |
+++ b/pkg/args/lib/src/options.dart |
@@ -1,5 +1,7 @@ |
library options; |
+import 'package:unmodifiable_collection/unmodifiable_collection.dart'; |
+ |
/** |
* A command-line option. Includes both flags and options which take a value. |
*/ |
@@ -15,9 +17,13 @@ class Option { |
final bool negatable; |
final bool allowMultiple; |
- Option(this.name, this.abbreviation, this.help, this.allowed, |
- this.allowedHelp, this.defaultValue, this.callback, {this.isFlag, |
- this.negatable, this.allowMultiple: false}) { |
+ Option(this.name, this.abbreviation, this.help, List<String> allowed, |
+ Map<String, String> allowedHelp, this.defaultValue, this.callback, |
+ {this.isFlag, this.negatable, this.allowMultiple: false}) : |
+ this.allowed = allowed == null ? |
+ null : new UnmodifiableListView(allowed), |
+ this.allowedHelp = allowedHelp == null ? |
+ null : new UnmodifiableMapView(allowedHelp) { |
if (name.isEmpty) { |
throw new ArgumentError('Name cannot be empty.'); |