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

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

Issue 11090016: Change core lib, dart2js, and more for new optional parameters syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
558 final bool isFlag; 558 final bool isFlag;
559 final bool negatable; 559 final bool negatable;
560 final bool allowMultiple; 560 final bool allowMultiple;
561 561
562 _Option(this.name, this.abbreviation, this.help, this.allowed, 562 _Option(this.name, this.abbreviation, this.help, this.allowed,
563 this.allowedHelp, this.defaultValue, this.callback, [this.isFlag, 563 this.allowedHelp, this.defaultValue, this.callback, {this.isFlag,
564 this.negatable, this.allowMultiple = false]); 564 this.negatable, this.allowMultiple: false});
565 } 565 }
566 566
567 /** 567 /**
568 * Takes an [ArgParser] and generates a string of usage (i.e. help) text for its 568 * Takes an [ArgParser] and generates a string of usage (i.e. help) text for its
569 * defined options. Internally, it works like a tabular printer. The output is 569 * defined options. Internally, it works like a tabular printer. The output is
570 * divided into three horizontal columns, like so: 570 * divided into three horizontal columns, like so:
571 * 571 *
572 * -h, --help Prints the usage information 572 * -h, --help Prints the usage information
573 * | | | | 573 * | | | |
574 * 574 *
(...skipping 201 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