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

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

Issue 82213002: Add a [hide] argument to [ArgParser.addFlag]. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | pkg/args/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return parser; 314 return parser;
315 } 315 }
316 316
317 /** 317 /**
318 * Defines a flag. Throws an [ArgumentError] if: 318 * Defines a flag. Throws an [ArgumentError] if:
319 * 319 *
320 * * There is already an option named [name]. 320 * * There is already an option named [name].
321 * * There is already an option using abbreviation [abbr]. 321 * * There is already an option using abbreviation [abbr].
322 */ 322 */
323 void addFlag(String name, {String abbr, String help, bool defaultsTo: false, 323 void addFlag(String name, {String abbr, String help, bool defaultsTo: false,
324 bool negatable: true, void callback(bool value)}) { 324 bool negatable: true, void callback(bool value), bool hide: false}) {
325 _addOption(name, abbr, help, null, null, defaultsTo, callback, 325 _addOption(name, abbr, help, null, null, defaultsTo, callback,
326 isFlag: true, negatable: negatable); 326 isFlag: true, negatable: negatable, hide: hide);
327 } 327 }
328 328
329 /** 329 /**
330 * Defines a value-taking option. Throws an [ArgumentError] if: 330 * Defines a value-taking option. Throws an [ArgumentError] if:
331 * 331 *
332 * * There is already an option with name [name]. 332 * * There is already an option with name [name].
333 * * There is already an option using abbreviation [abbr]. 333 * * There is already an option using abbreviation [abbr].
334 */ 334 */
335 void addOption(String name, {String abbr, String help, List<String> allowed, 335 void addOption(String name, {String abbr, String help, List<String> allowed,
336 Map<String, String> allowedHelp, String defaultsTo, 336 Map<String, String> allowedHelp, String defaultsTo,
(...skipping 109 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 | « no previous file | pkg/args/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698