From 2b051bcbda06ec48287e75da506bacf95be2b652 Mon Sep 17 00:00:00 2001 From: "Zen Lin(Zhinan Lin)" Date: Wed, 11 Mar 2015 18:48:57 +0800 Subject: [PATCH] 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) --- api/client/cli.go | 9 ++++++--- integration-cli/docker_cli_help_test.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/client/cli.go b/api/client/cli.go index 4c5eb2d0d6..fcf6c033fb 100644 --- a/api/client/cli.go +++ b/api/client/cli.go @@ -93,10 +93,13 @@ func (cli *DockerCli) Subcmd(name, signature, description string, exitOnError bo flags := flag.NewFlagSet(name, errorHandling) flags.Usage = func() { options := "" - if flags.FlagCountUndeprecated() > 0 { - options = "[OPTIONS] " + if signature != "" { + signature = " " + signature } - fmt.Fprintf(cli.out, "\nUsage: docker %s %s%s\n\n%s\n\n", name, options, signature, description) + if flags.FlagCountUndeprecated() > 0 { + options = " [OPTIONS]" + } + fmt.Fprintf(cli.out, "\nUsage: docker %s%s%s\n\n%s\n\n", name, options, signature, description) flags.SetOutput(cli.out) flags.PrintDefaults() os.Exit(0) diff --git a/integration-cli/docker_cli_help_test.go b/integration-cli/docker_cli_help_test.go index c48fbafc43..4ef8b7bd9e 100644 --- a/integration-cli/docker_cli_help_test.go +++ b/integration-cli/docker_cli_help_test.go @@ -130,7 +130,7 @@ func TestHelpTextVerify(t *testing.T) { if strings.HasPrefix(line, " -") && strings.HasSuffix(line, ".") { t.Fatalf("Help for %q should not end with a period: %s", cmd, line) } - + // Options should not end with a space if strings.HasSuffix(line, " ") { t.Fatalf("Help for %q should not end with a space: %s", cmd, line)