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

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

Issue 52573002: Remove uses of Options from pkg, samples, tests, and third_party directories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Edit comment Created 7 years, 1 month 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
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 * Parser support for transforming raw command-line arguments into a set 6 * Parser support for transforming raw command-line arguments into a set
7 * of options and values. 7 * of options and values.
8 * 8 *
9 * This library supports [GNU][] and [POSIX][] style options, and it works 9 * This library supports [GNU][] and [POSIX][] style options, and it works
10 * in both server-side and client-side apps. 10 * in both server-side and client-side apps.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 * is parsed. If an option isn't provided in the args, its callback is 77 * is parsed. If an option isn't provided in the args, its callback is
78 * passed the default value, or `null` if no default value is set. 78 * passed the default value, or `null` if no default value is set.
79 * 79 *
80 * ## Parsing arguments 80 * ## Parsing arguments
81 * 81 *
82 * Once you have an [ArgParser] set up with some options and flags, you 82 * Once you have an [ArgParser] set up with some options and flags, you
83 * use it by calling [ArgParser.parse()] with a set of arguments: 83 * use it by calling [ArgParser.parse()] with a set of arguments:
84 * 84 *
85 * var results = parser.parse(['some', 'command', 'line', 'args']); 85 * var results = parser.parse(['some', 'command', 'line', 'args']);
86 * 86 *
87 * These arguments usually come from dart:io's Options class 87 * These arguments usually come from the arguments to main
88 * (`new Options().arguments`), but you can pass in any list of strings. 88 * (`main(List<String> arguments`), but you can pass in any list of strings.
89 * The parse() method returns an instance of [ArgResults], a map-like 89 * The parse() method returns an instance of [ArgResults], a map-like
90 * object that contains the values of the parsed options. 90 * object that contains the values of the parsed options.
91 * 91 *
92 * var parser = new ArgParser(); 92 * var parser = new ArgParser();
93 * parser.addOption('mode'); 93 * parser.addOption('mode');
94 * parser.addFlag('verbose', defaultsTo: true); 94 * parser.addFlag('verbose', defaultsTo: true);
95 * var results = parser.parse(['--mode', 'debug', 'something', 'else']); 95 * var results = parser.parse(['--mode', 'debug', 'something', 'else']);
96 * 96 *
97 * print(results['mode']); // debug 97 * print(results['mode']); // debug
98 * print(results['verbose']); // true 98 * print(results['verbose']); // true
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 'Could not find an option named "$name".'); 446 'Could not find an option named "$name".');
447 } 447 }
448 448
449 return _options[name]; 449 return _options[name];
450 } 450 }
451 451
452 /** Get the names of the options as an [Iterable]. */ 452 /** Get the names of the options as an [Iterable]. */
453 Iterable<String> get options => _options.keys; 453 Iterable<String> get options => _options.keys;
454 } 454 }
455 455
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/services/runtime/coverage/coverage_impl.dart ('k') | pkg/csslib/lib/css.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698