display message improve in run

Signed-off-by: Lifubang <lifubang@acmcoder.com>
This commit is contained in:
Lifubang 2018-10-15 16:32:53 +08:00
parent b9a1a21fe2
commit bb3820b26d
1 changed files with 4 additions and 1 deletions

View File

@ -316,7 +316,10 @@ func attachContainer(
// reportError is a utility method that prints a user-friendly message // reportError is a utility method that prints a user-friendly message
// containing the error that occurred during parsing and a suggestion to get help // containing the error that occurred during parsing and a suggestion to get help
func reportError(stderr io.Writer, name string, str string, withHelp bool) { func reportError(stderr io.Writer, name string, str string, withHelp bool) {
str = strings.TrimSuffix(str, ".") + "." puncRegexp := regexp.MustCompile(`[\n\r\!\.\?]$`)
if !puncRegexp.MatchString(str) {
str += "."
}
if withHelp { if withHelp {
str += "\nSee '" + os.Args[0] + " " + name + " --help'." str += "\nSee '" + os.Args[0] + " " + name + " --help'."
} }