| 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('args.dart'); | 14 #import('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).', |
| 25 allowed: ['none', 'dart2js', 'dartc', 'frog'], | 25 allowed: ['none', 'dart2js', 'dartc'], |
| 26 allowedHelp: { | 26 allowedHelp: { |
| 27 'none': 'Do not compile the Dart code (run native Dart code on the' | 27 'none': 'Do not compile the Dart code (run native Dart code on the' |
| 28 ' VM).\n(only valid with the following runtimes: vm, drt)', | 28 ' VM).\n(only valid with the following runtimes: vm, drt)', |
| 29 'dart2js': 'Compile dart code to JavaScript by running dart2js (leg).\n' | 29 'dart2js': 'Compile dart code to JavaScript by running dart2js.\n' |
| 30 '(only valid with the following runtimes: same as frog)', | 30 '(only valid with the following runtimes: d8, drt, chrome\n' |
| 31 'safari, ie, firefox, opera, none (compile only))' |
| 31 'dartc': 'Perform static analysis on Dart code by running dartc.\n' | 32 'dartc': 'Perform static analysis on Dart code by running dartc.\n' |
| 32 '(only valid with the following runtimes: none)', | 33 '(only valid with the following runtimes: none)', |
| 33 'frog': '(DEPRECATED) Compile dart code to JavaScript by running the\n' | |
| 34 'frog compiler. (only valid with the following runtimes: d8,\n' | |
| 35 'drt, chrome, safari, ie, firefox, opera, none (compile only))' | |
| 36 }); | 34 }); |
| 37 | 35 |
| 38 parser.addOption('runtime', abbr: 'r', defaultsTo: 'vm', | 36 parser.addOption('runtime', abbr: 'r', defaultsTo: 'vm', |
| 39 help: 'Where the tests should be run.', | 37 help: 'Where the tests should be run.', |
| 40 allowed: ['vm', 'd8', 'drt', 'dartium', 'ff', 'firefox', 'chrome', | 38 allowed: ['vm', 'd8', 'drt', 'dartium', 'ff', 'firefox', 'chrome', |
| 41 'safari', 'ie', 'opera', 'none'], | 39 'safari', 'ie', 'opera', 'none'], |
| 42 allowedHelp: { | 40 allowedHelp: { |
| 43 'vm': 'Run Dart code on the standalone dart vm.', | 41 'vm': 'Run Dart code on the standalone dart vm.', |
| 44 'd8': 'Run JavaScript from the command line using v8.', | 42 'd8': 'Run JavaScript from the command line using v8.', |
| 45 'drt': 'Run Dart or JavaScript in the headless version of Chrome,\n' | 43 'drt': 'Run Dart or JavaScript in the headless version of Chrome,\n' |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 108 |
| 111 For example if the normal command that will be executed | 109 For example if the normal command that will be executed |
| 112 is 'dart file.dart' and you specify special command | 110 is 'dart file.dart' and you specify special command |
| 113 'python -u valgrind.py @ suffix' the final command will be | 111 'python -u valgrind.py @ suffix' the final command will be |
| 114 'python -u valgrind.py dart file.dart suffix'"""); | 112 'python -u valgrind.py dart file.dart suffix'"""); |
| 115 | 113 |
| 116 parser.addFlag('time', | 114 parser.addFlag('time', |
| 117 help: 'Print timing information after running tests', | 115 help: 'Print timing information after running tests', |
| 118 defaultsTo: false); | 116 defaultsTo: false); |
| 119 | 117 |
| 120 parser.addOption('frog', help: 'Path to frog script or executable'); | |
| 121 parser.addOption('dart', help: 'Path to dart executable'); | 118 parser.addOption('dart', help: 'Path to dart executable'); |
| 122 parser.addOption('drt', help: 'Path to DumpRenderTree executable'); | 119 parser.addOption('drt', help: 'Path to DumpRenderTree executable'); |
| 123 parser.addOption('dartium', help: 'Path to Dartium Chrome executable'); | 120 parser.addOption('dartium', help: 'Path to Dartium Chrome executable'); |
| 124 parser.addOption('froglib', help: 'Path to frog library'); | |
| 125 | 121 |
| 126 parser.addFlag('batch', abbr: 'b', | 122 parser.addFlag('batch', abbr: 'b', |
| 127 help: 'Run browser tests in batch mode', | 123 help: 'Run browser tests in batch mode', |
| 128 defaultsTo: true); | 124 defaultsTo: true); |
| 129 | 125 |
| 130 print(parser.getUsage()); | 126 print(parser.getUsage()); |
| 131 } | 127 } |
| OLD | NEW |