Browse code

fix usage for completly deprecated flag

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)

Victor Vieux authored on 2014/03/06 04:27:39
Showing 2 changed files
... ...
@@ -12,6 +12,7 @@ var (
12 12
 )
13 13
 
14 14
 func init() {
15
+	flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp")
15 16
 	flag.BoolVar(&b, []string{"b"}, false, "a simple bool")
16 17
 	flag.BoolVar(&b2, []string{"-bool"}, false, "a simple bool")
17 18
 	flag.IntVar(&i, []string{"#integer", "-integer"}, -1, "a simple integer")
... ...
@@ -404,7 +404,9 @@ func (f *FlagSet) PrintDefaults() {
404 404
 				names = append(names, name)
405 405
 			}
406 406
 		}
407
-		fmt.Fprintf(f.out(), format, strings.Join(names, ", -"), flag.DefValue, flag.Usage)
407
+		if len(names) > 0 {
408
+			fmt.Fprintf(f.out(), format, strings.Join(names, ", -"), flag.DefValue, flag.Usage)
409
+		}
408 410
 	})
409 411
 }
410 412