Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: tools/gardening/bin/bot.dart

Issue 2919693003: Fix gardening/bot help messages (Closed)
Patch Set: Add types and file header Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698