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

Unified 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: Done Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/args/lib/src/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/args/lib/args.dart
diff --git a/pkg/args/lib/args.dart b/pkg/args/lib/args.dart
index 9e6252a5a2b681ffba321741056ddd25183cc852..668577cc77ced8f16d5ff23e9a3f779fbb288944 100644
--- a/pkg/args/lib/args.dart
+++ b/pkg/args/lib/args.dart
@@ -347,9 +347,20 @@ class ArgParser {
/**
* Parses [args], a list of command-line arguments, matches them against the
* flags and options defined by this parser, and returns the result.
+ *
+ * If [allowTrailingOptions] is set, the parser will continue parsing even
+ * after it finds an argument that is neither an option nor a command.
+ * This allows options to be specified after regular arguments.
+ *
+ * [allowTrailingOptions] is false by default, so when a non-option,
+ * non-command argument is encountered, it and all remaining arguments,
+ * even those that look like options are passed to the innermost command.
*/
- ArgResults parse(List<String> args) =>
- new Parser(null, this, args.toList()).parse();
+ ArgResults parse(List<String> args, {bool allowTrailingOptions}) {
+ if (allowTrailingOptions == null) allowTrailingOptions = false;
+ return new Parser(null, this, args.toList(), null, null,
+ allowTrailingOptions: allowTrailingOptions).parse();
+ }
/**
* Generates a string displaying usage information for the defined options.
« no previous file with comments | « no previous file | pkg/args/lib/src/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698