Prechádzať zdrojové kódy

Merge pull request #2657 from dotcloud/fix_docker_images_output

use utils.ParseRepositoryTag instead of strings.split in docker images
Victor Vieux 11 rokov pred
rodič
commit
dcc9980550
1 zmenil súbory, kde vykonal 2 pridanie a 6 odobranie
  1. 2 6
      commands.go

+ 2 - 6
commands.go

@@ -1169,14 +1169,10 @@ func (cli *DockerCli) CmdImages(args ...string) error {
 			fmt.Fprintln(w, "REPOSITORY\tTAG\tIMAGE ID\tCREATED\tSIZE")
 		}
 
-		var repo string
-		var tag string
 		for _, out := range outs {
 			for _, repotag := range out.RepoTags {
 
-				components := strings.SplitN(repotag, ":", 2)
-				repo = components[0]
-				tag = components[1]
+				repo, tag := utils.ParseRepositoryTag(repotag)
 
 				if !*noTrunc {
 					out.ID = utils.TruncateID(out.ID)
@@ -1238,7 +1234,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))
 	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 {
 		fmt.Fprint(cli.out, "\n")
 	}