| OLD | NEW |
| 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 is an example of converting the args in test.dart to use this API. | 6 * This is an example of converting the args in test.dart to use this API. |
| 7 * It shows what it looks like to build an [ArgParser] and then, when the code | 7 * It shows what it looks like to build an [ArgParser] and then, when the code |
| 8 * is run, demonstrates what the generated usage text looks like. | 8 * is run, demonstrates what the generated usage text looks like. |
| 9 */ | 9 */ |
| 10 #library('example'); | 10 library example; |
| 11 | 11 |
| 12 #import('dart:io'); | 12 import 'dart:io'; |
| 13 | 13 |
| 14 #import('package:args/args.dart'); | 14 import 'package:args/args.dart'; |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 var parser = new ArgParser(); | 17 var parser = new ArgParser(); |
| 18 | 18 |
| 19 parser.addOption('mode', abbr: 'm', defaultsTo: 'debug', | 19 parser.addOption('mode', abbr: 'm', defaultsTo: 'debug', |
| 20 help: 'Mode in which to run the tests', | 20 help: 'Mode in which to run the tests', |
| 21 allowed: ['all', 'debug', 'release']); | 21 allowed: ['all', 'debug', 'release']); |
| 22 | 22 |
| 23 parser.addOption('compiler', abbr: 'c', defaultsTo: 'none', | 23 parser.addOption('compiler', abbr: 'c', defaultsTo: 'none', |
| 24 help: 'Specify any compilation step (if needed).', | 24 help: 'Specify any compilation step (if needed).', |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 parser.addOption('dart', help: 'Path to dart executable'); | 118 parser.addOption('dart', help: 'Path to dart executable'); |
| 119 parser.addOption('drt', help: 'Path to DumpRenderTree executable'); | 119 parser.addOption('drt', help: 'Path to DumpRenderTree executable'); |
| 120 parser.addOption('dartium', help: 'Path to Dartium Chrome executable'); | 120 parser.addOption('dartium', help: 'Path to Dartium Chrome executable'); |
| 121 | 121 |
| 122 parser.addFlag('batch', abbr: 'b', | 122 parser.addFlag('batch', abbr: 'b', |
| 123 help: 'Run browser tests in batch mode', | 123 help: 'Run browser tests in batch mode', |
| 124 defaultsTo: true); | 124 defaultsTo: true); |
| 125 | 125 |
| 126 print(parser.getUsage()); | 126 print(parser.getUsage()); |
| 127 } | 127 } |
| OLD | NEW |