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

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

Issue 11664006: Make Map.keys/values Iterables. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Add TODO that map.keys should return a Set. Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 operator [](String name) { 537 operator [](String name) {
538 if (!_options.containsKey(name)) { 538 if (!_options.containsKey(name)) {
539 throw new ArgumentError( 539 throw new ArgumentError(
540 'Could not find an option named "$name".'); 540 'Could not find an option named "$name".');
541 } 541 }
542 542
543 return _options[name]; 543 return _options[name];
544 } 544 }
545 545
546 /** Get the names of the options as a [Collection]. */ 546 /** Get the names of the options as a [Collection]. */
547 Collection<String> get options => _options.keys; 547 Collection<String> get options => _options.keys.toList();
548 } 548 }
549 549
550 class _Option { 550 class _Option {
551 final String name; 551 final String name;
552 final String abbreviation; 552 final String abbreviation;
553 final List allowed; 553 final List allowed;
554 final defaultValue; 554 final defaultValue;
555 final Function callback; 555 final Function callback;
556 final String help; 556 final String help;
557 final Map<String, String> allowedHelp; 557 final Map<String, String> allowedHelp;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 allowedBuffer.add(allowed); 776 allowedBuffer.add(allowed);
777 if (allowed == option.defaultValue) { 777 if (allowed == option.defaultValue) {
778 allowedBuffer.add(' (default)'); 778 allowedBuffer.add(' (default)');
779 } 779 }
780 first = false; 780 first = false;
781 } 781 }
782 allowedBuffer.add(']'); 782 allowedBuffer.add(']');
783 return allowedBuffer.toString(); 783 return allowedBuffer.toString();
784 } 784 }
785 } 785 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698