Browse code

Normalize the log for docker subcommand usage, delete unecessary blank after "[OPTIONS] " and add a blank to the log between options and signature.

To make the code style consistency.

Signed-off-by: Zen Lin(Zhinan Lin) <linzhinan@huawei.com>

Zen Lin(Zhinan Lin) authored on 2015/03/11 19:48:57
Showing 2 changed files
... ...
@@ -93,10 +93,13 @@ func (cli *DockerCli) Subcmd(name, signature, description string, exitOnError bo
93 93
 	flags := flag.NewFlagSet(name, errorHandling)
94 94
 	flags.Usage = func() {
95 95
 		options := ""
96
+		if signature != "" {
97
+			signature = " " + signature
98
+		}
96 99
 		if flags.FlagCountUndeprecated() > 0 {
97
-			options = "[OPTIONS] "
100
+			options = " [OPTIONS]"
98 101
 		}
99
-		fmt.Fprintf(cli.out, "\nUsage: docker %s %s%s\n\n%s\n\n", name, options, signature, description)
102
+		fmt.Fprintf(cli.out, "\nUsage: docker %s%s%s\n\n%s\n\n", name, options, signature, description)
100 103
 		flags.SetOutput(cli.out)
101 104
 		flags.PrintDefaults()
102 105
 		os.Exit(0)
... ...
@@ -130,7 +130,7 @@ func TestHelpTextVerify(t *testing.T) {
130 130
 				if strings.HasPrefix(line, "  -") && strings.HasSuffix(line, ".") {
131 131
 					t.Fatalf("Help for %q should not end with a period: %s", cmd, line)
132 132
 				}
133
-				
133
+
134 134
 				// Options should not end with a space
135 135
 				if strings.HasSuffix(line, " ") {
136 136
 					t.Fatalf("Help for %q should not end with a space: %s", cmd, line)