Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: pkg/args/lib/args.dart

Issue 12545013: Added the continueParsing option to ArgParser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/args/lib/src/parser.dart » ('j') | pkg/args/test/parse_test.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * This library lets you define parsers for parsing raw command-line arguments 6 * This library lets you define parsers for parsing raw command-line arguments
7 * into a set of options and values using [GNU][] and [POSIX][] style options. 7 * into a set of options and values using [GNU][] and [POSIX][] style options.
8 * 8 *
9 * ## Defining options ## 9 * ## Defining options ##
10 * 10 *
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 options[name] = new Option(name, abbr, help, allowed, allowedHelp, 300 options[name] = new Option(name, abbr, help, allowed, allowedHelp,
301 defaultsTo, callback, isFlag: isFlag, negatable: negatable, 301 defaultsTo, callback, isFlag: isFlag, negatable: negatable,
302 allowMultiple: allowMultiple); 302 allowMultiple: allowMultiple);
303 } 303 }
304 304
305 /** 305 /**
306 * Parses [args], a list of command-line arguments, matches them against the 306 * Parses [args], a list of command-line arguments, matches them against the
307 * flags and options defined by this parser, and returns the result. 307 * flags and options defined by this parser, and returns the result.
308 *
309 * If [continueParsing] is set, the parser will continue parsing even after it
310 * finds an argument that is not an option. This allows you to specify options
311 * after your command parameters.
308 */ 312 */
309 ArgResults parse(List<String> args) => 313 ArgResults parse(List<String> args, {bool continueParsing: false}) =>
310 new Parser(null, this, args.toList()).parse(); 314 new Parser(null, this, args.toList()).parse(
315 continueParsing: continueParsing);
311 316
312 /** 317 /**
313 * Generates a string displaying usage information for the defined options. 318 * Generates a string displaying usage information for the defined options.
314 * This is basically the help text shown on the command line. 319 * This is basically the help text shown on the command line.
315 */ 320 */
316 String getUsage() => new Usage(this).generate(); 321 String getUsage() => new Usage(this).generate();
317 322
318 /** 323 /**
319 * Get the default value for an option. Useful after parsing to test 324 * Get the default value for an option. Useful after parsing to test
320 * if the user specified something other than the default. 325 * if the user specified something other than the default.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 'Could not find an option named "$name".'); 398 'Could not find an option named "$name".');
394 } 399 }
395 400
396 return _options[name]; 401 return _options[name];
397 } 402 }
398 403
399 /** Get the names of the options as a [Collection]. */ 404 /** Get the names of the options as a [Collection]. */
400 Collection<String> get options => _options.keys.toList(growable: false); 405 Collection<String> get options => _options.keys.toList(growable: false);
401 } 406 }
402 407
OLDNEW
« no previous file with comments | « no previous file | pkg/args/lib/src/parser.dart » ('j') | pkg/args/test/parse_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698