cmd/gopherbot: add the list of tasks in the help message
Change-Id: I1c2456ad1854712492e5cb625e7652e6ed030229
Reviewed-on: https://go-review.googlesource.com/c/build/+/401694
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go
index 0edbf3d..5d2c13b 100644
--- a/cmd/gopherbot/gopherbot.go
+++ b/cmd/gopherbot/gopherbot.go
@@ -58,6 +58,19 @@
onlyRun = flag.String("only-run", "", "if non-empty, the name of a task to run. Mostly for debugging, but tasks (like 'kicktrain') may choose to only run in explicit mode")
)
+func init() {
+ flag.Usage = func() {
+ output := flag.CommandLine.Output()
+ fmt.Fprintf(output, "gopherbot runs Go's gopherbot role account on GitHub and Gerrit.\n\n")
+ flag.PrintDefaults()
+ fmt.Fprintln(output, "")
+ fmt.Fprintln(output, "Tasks (can be used for the --only-run flag):")
+ for _, t := range tasks {
+ fmt.Fprintf(output, " %q\n", t.name)
+ }
+ }
+}
+
const (
gopherbotGitHubID = 8566911
)
@@ -186,13 +199,6 @@
return apipb.NewMaintnerServiceClient(cc), nil
}
-func init() {
- flag.Usage = func() {
- os.Stderr.WriteString("gopherbot runs Go's gopherbot role account on GitHub and Gerrit.\n\n")
- flag.PrintDefaults()
- }
-}
-
type gerritChange struct {
project string
num int32