Index: tools/gardening/bin/bot.dart |
diff --git a/tools/gardening/bin/bot.dart b/tools/gardening/bin/bot.dart |
index d775bba15e63668862f36d129d718f9471fd8a08..2a39c5140344f67f5c6e123855502f978b3adca0 100644 |
--- a/tools/gardening/bin/bot.dart |
+++ b/tools/gardening/bin/bot.dart |
@@ -1,39 +1,47 @@ |
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+import 'dart:async'; |
import 'dart:io'; |
import 'compare_failures.dart' as compare_failures; |
import 'current_summary.dart' as current_summary; |
import 'status_summary.dart' as status_summary; |
-void help(List<String> args) { |
+typedef Future MainFunction(List<String> args); |
+ |
+help(List<String> args) async { |
if (args.length == 1 && args[0] == "--help") { |
print("This help"); |
- return; |
+ return null; |
} |
print("A script that combines multiple commands:\n"); |
- commands.forEach((command, fun) { |
- print("$command:"); |
- fun(["--help"]); |
+ for (String command in commands.keys) { |
+ print(command); |
+ print('-' * command.length); |
+ await commands[command](["--help"]); |
print(""); |
- }); |
+ } |
} |
-const commands = const { |
+const Map<String, MainFunction> commands = const <String, MainFunction>{ |
"help": help, |
"compare-failures": compare_failures.main, |
"current-summary": current_summary.main, |
"status-summary": status_summary.main, |
}; |
-void main(List<String> args) { |
+main(List<String> args) async { |
if (args.isEmpty) { |
- help([]); |
+ await help([]); |
exit(-1); |
} |
var command = commands[args[0]]; |
if (command == null) { |
- help([]); |
+ await help([]); |
exit(-1); |
} |
command(args.sublist(1)); |