Index: pkg/args/lib/args.dart |
diff --git a/pkg/args/lib/args.dart b/pkg/args/lib/args.dart |
index 9e6252a5a2b681ffba321741056ddd25183cc852..b91e2e08e7af634bce28fcae90cc4185d55a643b 100644 |
--- a/pkg/args/lib/args.dart |
+++ b/pkg/args/lib/args.dart |
@@ -347,9 +347,23 @@ 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 command parameters. |
Bob Nystrom
2013/06/24 15:53:20
"command parameters" -> "regular arguments".
Andrei Mouravski
2013/06/24 20:41:04
Done.
|
+ * |
+ * [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 leafmost command. |
Bob Nystrom
2013/06/24 15:53:20
"leafmost" -> "innermost".
Andrei Mouravski
2013/06/24 20:41:04
Done.
|
+ * |
+ * An argument that looks like an option, but does not match any option will |
+ * throw a [FormatException], regardless of the value |
+ * of [allowTrailingOptions]. |
Bob Nystrom
2013/06/24 15:53:20
This is a bit confusing. It isn't clear that this
Andrei Mouravski
2013/06/24 20:41:04
Done.
|
*/ |
- 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(), allowTrailingOptions).parse(); |
Bob Nystrom
2013/06/24 15:53:20
It should be a named argument here too.
Andrei Mouravski
2013/06/24 20:41:04
Done.
|
+ } |
/** |
* Generates a string displaying usage information for the defined options. |