| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 options; | 5 library options; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
| 10 | 10 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 _knownFlags.add(name); | 269 _knownFlags.add(name); |
| 270 _parser.addOption(name, abbr: abbr, help: help, allowed: allowed, | 270 _parser.addOption(name, abbr: abbr, help: help, allowed: allowed, |
| 271 allowedHelp: allowedHelp, defaultsTo: defaultsTo, callback: callback, | 271 allowedHelp: allowedHelp, defaultsTo: defaultsTo, callback: callback, |
| 272 allowMultiple: allowMultiple); | 272 allowMultiple: allowMultiple); |
| 273 } | 273 } |
| 274 | 274 |
| 275 | 275 |
| 276 /** | 276 /** |
| 277 * Generates a string displaying usage information for the defined options. | 277 * Generates a string displaying usage information for the defined options. |
| 278 * | 278 * |
| 279 * See [ArgParser.getUsage()]. | 279 * See [ArgParser.usage]. |
| 280 */ | 280 */ |
| 281 String getUsage() => _parser.getUsage(); | 281 String getUsage() => _parser.usage; |
| 282 | 282 |
| 283 /** | 283 /** |
| 284 * Parses [args], a list of command-line arguments, matches them against the | 284 * Parses [args], a list of command-line arguments, matches them against the |
| 285 * flags and options defined by this parser, and returns the result. The | 285 * flags and options defined by this parser, and returns the result. The |
| 286 * values of any defined variables are captured in the given map. | 286 * values of any defined variables are captured in the given map. |
| 287 * | 287 * |
| 288 * See [ArgParser]. | 288 * See [ArgParser]. |
| 289 */ | 289 */ |
| 290 ArgResults parse(List<String> args, Map<String, String> definedVariables) => _
parser.parse(_filterUnknowns(parseDefinedVariables(args, definedVariables))); | 290 ArgResults parse(List<String> args, Map<String, String> definedVariables) => _
parser.parse(_filterUnknowns(parseDefinedVariables(args, definedVariables))); |
| 291 | 291 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 _getNextFlagIndex(args, i) { | 341 _getNextFlagIndex(args, i) { |
| 342 for ( ; i < args.length; ++i) { | 342 for ( ; i < args.length; ++i) { |
| 343 if (args[i].startsWith('--')) { | 343 if (args[i].startsWith('--')) { |
| 344 return i; | 344 return i; |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 return i; | 347 return i; |
| 348 } | 348 } |
| 349 } | 349 } |
| OLD | NEW |