Chromium Code Reviews| Index: lib/args/args.dart |
| =================================================================== |
| --- lib/args/args.dart (revision 10607) |
| +++ lib/args/args.dart (working copy) |
| @@ -489,6 +489,19 @@ |
| return null; |
| } |
| + |
| + /** |
| + * Get the default value for an option. Useful after parsing to test |
| + * if the user specified something other than the default. |
| + */ |
| + |
| + getDefault(String option) { |
|
Bob Nystrom
2012/08/16 22:22:10
Delete blank line above this.
|
| + if (_options.containsKey(option)) { |
| + return _options[option].defaultValue; |
| + } else { |
| + throw new IllegalArgumentException('No option named $option'); |
|
Bob Nystrom
2012/08/16 22:22:10
Nit, but when possible, I prefer validating the ar
gram
2012/08/16 23:20:17
Done.
|
| + } |
| + } |
| } |
| /** |
| @@ -518,6 +531,9 @@ |
| return _options[name]; |
| } |
| + |
| + /** Get the names of the options as a [Collection]. */ |
| + Collection<String> get options => _options.getKeys(); |
| } |
| class _Option { |