diff options
author | Hu Keping <hukeping@huawei.com> | 2015-07-08 04:10:29 +0800 |
---|---|---|
committer | Hu Keping <hukeping@huawei.com> | 2015-09-22 21:27:20 +0800 |
commit | 6353f3a7b58fe7ef1cb33660003c1d7205f2e6c0 (patch) | |
tree | 4a25649f0ed4619ea3fc06c5c6f0028df91d4c1f | |
parent | a7e23cab8d10003914e39f1c954278c7be6bd759 (diff) | |
download | docker-6353f3a7b58fe7ef1cb33660003c1d7205f2e6c0.tar.gz |
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>
-rw-r--r-- | api/client/history.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/api/client/history.go b/api/client/history.go index 925add6640..2c443efd3c 100644 --- a/api/client/history.go +++ b/api/client/history.go @@ -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 { |