| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 * | 233 * |
| 234 * parser.addOption('arch', help: 'The architecture to compile for', | 234 * parser.addOption('arch', help: 'The architecture to compile for', |
| 235 * allowedHelp: { | 235 * allowedHelp: { |
| 236 * 'ia32': 'Intel x86', | 236 * 'ia32': 'Intel x86', |
| 237 * 'arm': 'ARM Holding 32-bit chip' | 237 * 'arm': 'ARM Holding 32-bit chip' |
| 238 * }); | 238 * }); |
| 239 * | 239 * |
| 240 * To display the help, use the ArgParser getUsage() method: | 240 * To display the help, use the ArgParser getUsage() method: |
| 241 * | 241 * |
| 242 * print(parser.getUsage()); | 242 * print(parser.getUsage()); |
| 243 * | 243 * |
| 244 * The resulting string looks something like this: | 244 * The resulting string looks something like this: |
| 245 * | 245 * |
| 246 * --mode The compiler configuration | 246 * --mode The compiler configuration |
| 247 * [debug, release] | 247 * [debug, release] |
| 248 * | 248 * |
| 249 * --[no-]verbose Show additional diagnostic info | 249 * --[no-]verbose Show additional diagnostic info |
| 250 * --arch The architecture to compile for | 250 * --arch The architecture to compile for |
| 251 * | 251 * |
| 252 * [arm] ARM Holding 32-bit chip | 252 * [arm] ARM Holding 32-bit chip |
| 253 * [ia32] Intel x86 | 253 * [ia32] Intel x86 |
| 254 * | 254 * |
| 255 * To assist the formatting of the usage help, single-line help text is | 255 * To assist the formatting of the usage help, single-line help text is |
| 256 * followed by a single new line. Options with multi-line help text are | 256 * followed by a single new line. Options with multi-line help text are |
| 257 * followed by two new lines. This provides spatial diversity between options. | 257 * followed by two new lines. This provides spatial diversity between options. |
| 258 * | 258 * |
| 259 * [posix]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.h
tml#tag_12_02 | 259 * [posix]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.h
tml#tag_12_02 |
| 260 * [gnu]: http://www.gnu.org/prep/standards/standards.html#Command_002dLine-Inte
rfaces | 260 * [gnu]: http://www.gnu.org/prep/standards/standards.html#Command_002dLine-Inte
rfaces |
| 261 */ | 261 */ |
| 262 library args; | 262 library args; |
| 263 | 263 |
| 264 import 'package:unmodifiable_collection/unmodifiable_collection.dart'; | 264 import 'package:collection_helpers/wrappers.dart'; |
| 265 | 265 |
| 266 import 'src/parser.dart'; | 266 import 'src/parser.dart'; |
| 267 import 'src/usage.dart'; | 267 import 'src/usage.dart'; |
| 268 import 'src/options.dart'; | 268 import 'src/options.dart'; |
| 269 export 'src/options.dart'; | 269 export 'src/options.dart'; |
| 270 | 270 |
| 271 /** | 271 /** |
| 272 * A class for taking a list of raw command line arguments and parsing out | 272 * A class for taking a list of raw command line arguments and parsing out |
| 273 * options and flags from them. | 273 * options and flags from them. |
| 274 */ | 274 */ |
| (...skipping 171 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 |