| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |