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

add image size to -tree

This commit is contained in:
Nate Jones 2013-10-27 23:42:09 +00:00
parent f1aeac361a
commit b7d1d35c27
2 changed files with 5 additions and 4 deletions

View file

@ -1231,10 +1231,11 @@ func PrintTreeNode(cli *DockerCli, noTrunc *bool, image APIImages, prefix string
imageID = utils.TruncateID(image.ID)
}
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, "%s%s Tags: %s\n", prefix, imageID, strings.Join(image.RepoTags, ","))
fmt.Fprintf(cli.out, " Tags: %s\n", strings.Join(image.RepoTags, ","))
} else {
fmt.Fprintf(cli.out, "%s%s\n", prefix, imageID)
fmt.Fprint(cli.out, "\n")
}
}

View file

@ -778,11 +778,11 @@ func TestImagesTree(t *testing.T) {
cmdOutput := string(cmdOutputBytes)
regexpStrings := []string{
fmt.Sprintf("└─%s Tags: %s:latest", unitTestImageIDShort, unitTestImageName),
fmt.Sprintf("└─%s Size: (\\d+.\\d+ MB) \\(virtual \\d+.\\d+ MB\\) Tags: %s:latest", unitTestImageIDShort, unitTestImageName),
"(?m)^ └─[0-9a-f]+",
"(?m)^ └─[0-9a-f]+",
"(?m)^ └─[0-9a-f]+",
fmt.Sprintf(" └─%s Tags: test:latest", utils.TruncateID(image.ID)),
fmt.Sprintf(" └─%s Size: \\d+.\\d+ kB \\(virtual \\d+.\\d+ MB\\) Tags: test:latest", utils.TruncateID(image.ID)),
}
compiledRegexps := []*regexp.Regexp{}