From: Rob Pike Date: Fri, 21 Oct 2011 18:16:46 +0000 (-0700) Subject: gotest: make it easier to get the help string X-Git-Tag: weekly.2011-10-25~17 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c6bdef3fd83aa826abe14e8a63924365a286057f;p=gostls13.git 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 --- 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 }