1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

use utils.ParseRepositoryTag instead of strings.split in docker images

This commit is contained in:
Victor Vieux 2013-11-11 13:54:17 -08:00
parent 4c7d24bc8b
commit 84a3600ea8

View file

@ -1172,14 +1172,10 @@ func (cli *DockerCli) CmdImages(args ...string) error {
fmt.Fprintln(w, "REPOSITORY\tTAG\tIMAGE ID\tCREATED\tSIZE") fmt.Fprintln(w, "REPOSITORY\tTAG\tIMAGE ID\tCREATED\tSIZE")
} }
var repo string
var tag string
for _, out := range outs { for _, out := range outs {
for _, repotag := range out.RepoTags { for _, repotag := range out.RepoTags {
components := strings.SplitN(repotag, ":", 2) repo, tag := utils.ParseRepositoryTag(repotag)
repo = components[0]
tag = components[1]
if !*noTrunc { if !*noTrunc {
out.ID = utils.TruncateID(out.ID) out.ID = utils.TruncateID(out.ID)
@ -1241,7 +1237,7 @@ func PrintTreeNode(cli *DockerCli, noTrunc *bool, image APIImages, prefix string
fmt.Fprintf(cli.out, "%s%s Size: %s (virtual %s)", prefix, imageID, utils.HumanSize(image.Size), utils.HumanSize(image.VirtualSize)) fmt.Fprintf(cli.out, "%s%s Size: %s (virtual %s)", prefix, imageID, utils.HumanSize(image.Size), utils.HumanSize(image.VirtualSize))
if image.RepoTags[0] != "<none>:<none>" { if image.RepoTags[0] != "<none>:<none>" {
fmt.Fprintf(cli.out, " Tags: %s\n", strings.Join(image.RepoTags, ",")) fmt.Fprintf(cli.out, " Tags: %s\n", strings.Join(image.RepoTags, ", "))
} else { } else {
fmt.Fprint(cli.out, "\n") fmt.Fprint(cli.out, "\n")
} }