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
This commit is contained in:
Rob Pike 2011-10-21 11:16:46 -07:00
parent 2cab897ce0
commit c6bdef3fd8

View 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
}