aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-10-21 11:16:46 -0700
committerRob Pike <r@golang.org>2011-10-21 11:16:46 -0700
commitc6bdef3fd83aa826abe14e8a63924365a286057f (patch)
tree8d321062f88654b27de33e7592aafbffee8f0151
parent2cab897ce055fd753821a85a2134affe64ffe8cb (diff)
downloadgo-c6bdef3fd83aa826abe14e8a63924365a286057f.tar.gz
go-c6bdef3fd83aa826abe14e8a63924365a286057f.zip
gotest: make it easier to get the help string
Because gotest's args are mingled with the tests, it's hard to get the usage message to print. This CL adds explicit support for -help, spelled several different ways. Gotest has special flags like -file that are somewhat hidden otherwise. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5298052
-rw-r--r--src/cmd/gotest/flag.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/gotest/flag.go b/src/cmd/gotest/flag.go
index f8c2061ec6..0df9e24f13 100644
--- a/src/cmd/gotest/flag.go
+++ b/src/cmd/gotest/flag.go
@@ -107,6 +107,10 @@ func flag(i int) (f *flagSpec, value string, extra bool) {
if strings.HasPrefix(arg, "--") { // reduce two minuses to one
arg = arg[1:]
}
+ switch arg {
+ case "-?", "-h", "-help":
+ usage()
+ }
if arg == "" || arg[0] != '-' {
return
}