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_parser; | |
6 | |
7 import 'dart:collection'; | 5 import 'dart:collection'; |
8 | 6 |
9 import 'arg_results.dart'; | 7 import 'arg_results.dart'; |
10 import 'option.dart'; | 8 import 'option.dart'; |
11 import 'parser.dart'; | 9 import 'parser.dart'; |
12 import 'usage.dart'; | 10 import 'usage.dart'; |
13 | 11 |
14 /// A class for taking a list of raw command line arguments and parsing out | 12 /// A class for taking a list of raw command line arguments and parsing out |
15 /// options and flags from them. | 13 /// options and flags from them. |
16 class ArgParser { | 14 class ArgParser { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return options[option].defaultValue; | 152 return options[option].defaultValue; |
155 } | 153 } |
156 | 154 |
157 /// Finds the option whose abbreviation is [abbr], or `null` if no option has | 155 /// Finds the option whose abbreviation is [abbr], or `null` if no option has |
158 /// that abbreviation. | 156 /// that abbreviation. |
159 Option findByAbbreviation(String abbr) { | 157 Option findByAbbreviation(String abbr) { |
160 return options.values.firstWhere((option) => option.abbreviation == abbr, | 158 return options.values.firstWhere((option) => option.abbreviation == abbr, |
161 orElse: () => null); | 159 orElse: () => null); |
162 } | 160 } |
163 } | 161 } |
OLD | NEW |