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>
This commit is contained in:
Zen Lin(Zhinan Lin) 2015-03-11 18:48:57 +08:00
parent f63a29ddee
commit 2b051bcbda
2 changed files with 7 additions and 4 deletions

View File

@ -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)