OLD | NEW |
(Empty) | |
| 1 import 'dart:io'; |
| 2 |
| 3 import 'compare_failures.dart' as compare_failures; |
| 4 import 'current_summary.dart' as current_summary; |
| 5 import 'status_summary.dart' as status_summary; |
| 6 |
| 7 void help(List<String> args) { |
| 8 if (args.length == 1 && args[0] == "--help") { |
| 9 print("This help"); |
| 10 return; |
| 11 } |
| 12 |
| 13 print("A script that combines multiple commands:\n"); |
| 14 |
| 15 commands.forEach((command, fun) { |
| 16 print("$command:"); |
| 17 fun(["--help"]); |
| 18 print(""); |
| 19 }); |
| 20 } |
| 21 |
| 22 const commands = const { |
| 23 "help": help, |
| 24 "compare-failures": compare_failures.main, |
| 25 "current-summary": current_summary.main, |
| 26 "status-summary": status_summary.main, |
| 27 }; |
| 28 |
| 29 void main(List<String> args) { |
| 30 if (args.isEmpty) { |
| 31 help([]); |
| 32 exit(-1); |
| 33 } |
| 34 var command = commands[args[0]]; |
| 35 if (command == null) { |
| 36 help([]); |
| 37 exit(-1); |
| 38 } |
| 39 command(args.sublist(1)); |
| 40 } |
OLD | NEW |