Format the output of docker history

Once there have '\t' in the "CREATED BY" section, it will possibly
cause a messy output of docker history.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 6353f3a7b58fe7ef1cb33660003c1d7205f2e6c0
Component: engine
This commit is contained in:
Hu Keping
2015-09-22 21:27:20 +08:00
parent f5dba44987
commit a5107b7eb0
+3 -2
View File
@@ -3,6 +3,7 @@ package client
import (
"encoding/json"
"fmt"
"strings"
"text/tabwriter"
"time"
@@ -57,9 +58,9 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
}
if *noTrunc {
fmt.Fprintf(w, "%s\t", entry.CreatedBy)
fmt.Fprintf(w, "%s\t", strings.Replace(entry.CreatedBy, "\t", " ", -1))
} else {
fmt.Fprintf(w, "%s\t", stringutils.Truncate(entry.CreatedBy, 45))
fmt.Fprintf(w, "%s\t", stringutils.Truncate(strings.Replace(entry.CreatedBy, "\t", " ", -1), 45))
}
if *human {