]> Cypherpunks repositories - gostls13.git/commitdiff
gotest: make it easier to get the help string
authorRob Pike <r@golang.org>
Fri, 21 Oct 2011 18:16:46 +0000 (11:16 -0700)
committerRob Pike <r@golang.org>
Fri, 21 Oct 2011 18:16:46 +0000 (11:16 -0700)
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

src/cmd/gotest/flag.go

index f8c2061ec6859e87593d0248ae208b9cef979d7f..0df9e24f133c897529c8db29e03ac87c80d61d92 100644 (file)
@@ -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
        }