| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library args.src.arg_results; | 5 library args.src.arg_results; |
| 6 | 6 |
| 7 import 'package:collection/wrappers.dart'; | 7 import 'package:collection/wrappers.dart'; |
| 8 | 8 |
| 9 import 'arg_parser.dart'; | 9 import 'arg_parser.dart'; |
| 10 | 10 |
| 11 /// Creates a new [ArgResults]. | 11 /// Creates a new [ArgResults]. |
| 12 /// | 12 /// |
| 13 /// Since [ArgResults] doesn't have a public constructor, this lets [Parser] | 13 /// Since [ArgResults] doesn't have a public constructor, this lets [Parser] |
| 14 /// get to it. This function isn't exported to the public API of the package. | 14 /// get to it. This function isn't exported to the public API of the package. |
| 15 ArgResults newArgResults(ArgParser parser, Map<String, dynamic> parsed, | 15 ArgResults newArgResults(ArgParser parser, Map<String, dynamic> parsed, |
| 16 String name, ArgResults command, List<String> rest, | 16 String name, ArgResults command, List<String> rest, |
| 17 List<String> arguments) { | 17 List<String> arguments) { |
| 18 return new ArgResults._(parser, parsed, name, command, rest, arguments); | 18 return new ArgResults._(parser, parsed, name, command, rest, arguments); |
| 19 } | 19 } |
| 20 | 20 |
| 21 /// The results of parsing a series of command line arguments using | 21 /// The results of parsing a series of command line arguments using |
| 22 /// [ArgParser.parse()]. | 22 /// [ArgParser.parse()]. |
| 23 /// | 23 /// |
| 24 /// Includes the parsed options and any remaining unparsed command line | 24 /// Includes the parsed options and any remaining unparsed command line |
| 25 /// arguments. | 25 /// arguments. |
| 26 class ArgResults { | 26 class ArgResults { |
| 27 /// The [ArgParser] whose options were parsed for these results. | 27 /// The [ArgParser] whose options were parsed for these results. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 /// value would be used instead. | 87 /// value would be used instead. |
| 88 bool wasParsed(String name) { | 88 bool wasParsed(String name) { |
| 89 var option = _parser.options[name]; | 89 var option = _parser.options[name]; |
| 90 if (option == null) { | 90 if (option == null) { |
| 91 throw new ArgumentError('Could not find an option named "$name".'); | 91 throw new ArgumentError('Could not find an option named "$name".'); |
| 92 } | 92 } |
| 93 | 93 |
| 94 return _parsed.containsKey(name); | 94 return _parsed.containsKey(name); |
| 95 } | 95 } |
| 96 } | 96 } |
| OLD | NEW |