Commit c6bdef3f authored by Rob Pike's avatar Rob Pike

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
parent 2cab897c
...@@ -107,6 +107,10 @@ func flag(i int) (f *flagSpec, value string, extra bool) { ...@@ -107,6 +107,10 @@ func flag(i int) (f *flagSpec, value string, extra bool) {
if strings.HasPrefix(arg, "--") { // reduce two minuses to one if strings.HasPrefix(arg, "--") { // reduce two minuses to one
arg = arg[1:] arg = arg[1:]
} }
switch arg {
case "-?", "-h", "-help":
usage()
}
if arg == "" || arg[0] != '-' { if arg == "" || arg[0] != '-' {
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment