mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-08 15:01:42 +00:00
Merge pull request #11710 from runcom/11599-refactor-pkg-common
Refactor pkg/common, Fixes #11599
This commit is contained in:
@@ -33,7 +33,6 @@ import (
|
||||
"github.com/docker/docker/nat"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/common"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/docker/docker/pkg/homedir"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
@@ -43,6 +42,7 @@ import (
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/resolvconf"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/docker/pkg/symlink"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/pkg/timeutils"
|
||||
@@ -1166,7 +1166,7 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
|
||||
if *noTrunc {
|
||||
fmt.Fprintf(w, "%s\t", outID)
|
||||
} else {
|
||||
fmt.Fprintf(w, "%s\t", common.TruncateID(outID))
|
||||
fmt.Fprintf(w, "%s\t", stringid.TruncateID(outID))
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%s ago\t", units.HumanDuration(time.Now().UTC().Sub(time.Unix(out.GetInt64("Created"), 0))))
|
||||
@@ -1181,7 +1181,7 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
|
||||
if *noTrunc {
|
||||
fmt.Fprintln(w, outID)
|
||||
} else {
|
||||
fmt.Fprintln(w, common.TruncateID(outID))
|
||||
fmt.Fprintln(w, stringid.TruncateID(outID))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1480,7 +1480,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
||||
}
|
||||
|
||||
if matchName != "" {
|
||||
if matchName == image.Get("Id") || matchName == common.TruncateID(image.Get("Id")) {
|
||||
if matchName == image.Get("Id") || matchName == stringid.TruncateID(image.Get("Id")) {
|
||||
startImage = image
|
||||
}
|
||||
|
||||
@@ -1550,7 +1550,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
||||
for _, out := range outs.Data {
|
||||
outID := out.Get("Id")
|
||||
if !*noTrunc {
|
||||
outID = common.TruncateID(outID)
|
||||
outID = stringid.TruncateID(outID)
|
||||
}
|
||||
|
||||
repoTags := out.GetList("RepoTags")
|
||||
@@ -1630,8 +1630,8 @@ func (cli *DockerCli) printVizNode(noTrunc bool, image *engine.Env, prefix strin
|
||||
imageID = image.Get("Id")
|
||||
parentID = image.Get("ParentId")
|
||||
} else {
|
||||
imageID = common.TruncateID(image.Get("Id"))
|
||||
parentID = common.TruncateID(image.Get("ParentId"))
|
||||
imageID = stringid.TruncateID(image.Get("Id"))
|
||||
parentID = stringid.TruncateID(image.Get("ParentId"))
|
||||
}
|
||||
if parentID == "" {
|
||||
fmt.Fprintf(cli.out, " base -> \"%s\" [style=invis]\n", imageID)
|
||||
@@ -1650,7 +1650,7 @@ func (cli *DockerCli) printTreeNode(noTrunc bool, image *engine.Env, prefix stri
|
||||
if noTrunc {
|
||||
imageID = image.Get("Id")
|
||||
} else {
|
||||
imageID = common.TruncateID(image.Get("Id"))
|
||||
imageID = stringid.TruncateID(image.Get("Id"))
|
||||
}
|
||||
|
||||
fmt.Fprintf(cli.out, "%s%s Virtual Size: %s", prefix, imageID, units.HumanSize(float64(image.GetInt64("VirtualSize"))))
|
||||
@@ -1758,7 +1758,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
|
||||
outID := out.Get("Id")
|
||||
|
||||
if !*noTrunc {
|
||||
outID = common.TruncateID(outID)
|
||||
outID = stringid.TruncateID(outID)
|
||||
}
|
||||
|
||||
if *quiet {
|
||||
|
||||
Reference in New Issue
Block a user