fix usage for completly deprecated flag

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
This commit is contained in:
Victor Vieux 2014-03-05 19:27:39 +00:00
parent 9101686161
commit 089bf5e11e
2 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,7 @@ var (
)
func init() {
flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp")
flag.BoolVar(&b, []string{"b"}, false, "a simple bool")
flag.BoolVar(&b2, []string{"-bool"}, false, "a simple bool")
flag.IntVar(&i, []string{"#integer", "-integer"}, -1, "a simple integer")

View File

@ -404,7 +404,9 @@ func (f *FlagSet) PrintDefaults() {
names = append(names, name)
}
}
fmt.Fprintf(f.out(), format, strings.Join(names, ", -"), flag.DefValue, flag.Usage)
if len(names) > 0 {
fmt.Fprintf(f.out(), format, strings.Join(names, ", -"), flag.DefValue, flag.Usage)
}
})
}