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

Unified Diff: README.md

Issue 975463004: Parse comma-separated multiple values. (Closed) Base URL: git@github.com:dart-lang/args@master
Patch Set: Code review changes Created 5 years, 10 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
Index: README.md
diff --git a/README.md b/README.md
index fa635cb4eb7686783642b963f99892947b9d27c8..96df5e6a8981e0caa838f7cfc7d4efcc401631a0 100644
--- a/README.md
+++ b/README.md
@@ -189,6 +189,17 @@ var results = parser.parse(['--mode', 'on', '--mode', 'off']);
print(results['mode']); // prints '[on, off]'
```
+By default, values for a multi-valued option may also be separated with commas:
+
+```dart
+var parser = new ArgParser();
+parser.addOption('mode', allowMultiple: true);
+var results = parser.parse(['--mode', 'on,off']);
+print(results['mode']); // prints '[on, off]'
+```
+
+This can be disabled by passing `splitCommas: false`.
+
## Defining commands ##
In addition to *options*, you can also define *commands*. A command is a named
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/arg_parser.dart » ('j') | lib/src/arg_parser.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698