mirror of
https://github.com/golang/go
synced 2024-11-02 11:50:30 +00:00
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:
parent
2cab897ce0
commit
c6bdef3fd8
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue