From 3f1feaf4d66a7a8770a0eab4356106be2a18aacb Mon Sep 17 00:00:00 2001 From: allencloud Date: Thu, 29 Dec 2016 01:09:25 +0800 Subject: [PATCH] purify error message in cli for create and run command Signed-off-by: allencloud --- cli/command/container/run.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/command/container/run.go b/cli/command/container/run.go index 4d85ee77ac..cbe64548ea 100644 --- a/cli/command/container/run.go +++ b/cli/command/container/run.go @@ -255,10 +255,11 @@ func runRun(dockerCli *command.DockerCli, flags *pflag.FlagSet, opts *runOptions // reportError is a utility method that prints a user-friendly message // containing the error that occurred during parsing and a suggestion to get help func reportError(stderr io.Writer, name string, str string, withHelp bool) { + str = strings.TrimSuffix(str, ".") + "." if withHelp { - str += ".\nSee '" + os.Args[0] + " " + name + " --help'" + str += "\nSee '" + os.Args[0] + " " + name + " --help'." } - fmt.Fprintf(stderr, "%s: %s.\n", os.Args[0], str) + fmt.Fprintf(stderr, "%s: %s\n", os.Args[0], str) } // if container start fails with 'not found'/'no such' error, return 127