summaryrefslogtreecommitdiff
path: root/cmd/podman/system_df.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-28 09:21:48 -0700
committerGitHub <noreply@github.com>2019-03-28 09:21:48 -0700
commit9085898ce2d42bf872c137e981202820066736c7 (patch)
tree0cd0fba9abbd5f78a4aea89792224be44b3991ee /cmd/podman/system_df.go
parentef1b58e6f28d21959196d29d5e9ab065d4e9a818 (diff)
parent2729695892aeb9e3b4a333e4983c6db81e68a27a (diff)
downloadpodman-9085898ce2d42bf872c137e981202820066736c7.tar.gz
podman-9085898ce2d42bf872c137e981202820066736c7.tar.bz2
podman-9085898ce2d42bf872c137e981202820066736c7.zip
Merge pull request #2773 from QiWang19/bug
fix bug `system df` add a space to the output
Diffstat (limited to 'cmd/podman/system_df.go')
-rw-r--r--cmd/podman/system_df.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/podman/system_df.go b/cmd/podman/system_df.go
index 60da4238a..992e869bd 100644
--- a/cmd/podman/system_df.go
+++ b/cmd/podman/system_df.go
@@ -85,6 +85,9 @@ type volumeVerboseDiskUsage struct {
}
const systemDfDefaultFormat string = "table {{.Type}}\t{{.Total}}\t{{.Active}}\t{{.Size}}\t{{.Reclaimable}}"
+const imageVerboseFormat string = "table {{.Repository}}\t{{.Tag}}\t{{.ImageID}}\t{{.Created}}\t{{.Size}}\t{{.SharedSize}}\t{{.UniqueSize}}\t{{.Containers}}"
+const containerVerboseFormat string = "table {{.ContainerID}}\t{{.Image}}\t{{.Command}}\t{{.LocalVolumes}}\t{{.Size}}\t{{.Created}}\t{{.Status}}\t{{.Names}}"
+const volumeVerboseFormat string = "table {{.VolumeName}}\t{{.Links}}\t{{.Size}}"
func init() {
dfSystemCommand.Command = _dfSystemCommand
@@ -473,7 +476,7 @@ func getImageVerboseDiskUsage(ctx context.Context, images []*image.Image, images
Repository: repo,
Tag: tag,
ImageID: shortID(img.ID()),
- Created: units.HumanDuration(time.Since((img.Created().Local()))) + " ago",
+ Created: fmt.Sprintf("%s ago", units.HumanDuration(time.Since((img.Created().Local())))),
Size: units.HumanSizeWithPrecision(float64(*size), 3),
SharedSize: units.HumanSizeWithPrecision(float64(*size-imgUniqueSizeMap[img.ID()]), 3),
UniqueSize: units.HumanSizeWithPrecision(float64(imgUniqueSizeMap[img.ID()]), 3),
@@ -502,7 +505,7 @@ func getContainerVerboseDiskUsage(containers []*libpod.Container) (containersVer
Command: strings.Join(ctr.Command(), " "),
LocalVolumes: len(ctr.UserVolumes()),
Size: units.HumanSizeWithPrecision(float64(size), 3),
- Created: units.HumanDuration(time.Since(ctr.CreatedTime().Local())) + "ago",
+ Created: fmt.Sprintf("%s ago", units.HumanDuration(time.Since(ctr.CreatedTime().Local()))),
Status: state.String(),
Names: ctr.Name(),
}
@@ -548,7 +551,7 @@ func imagesVerboseOutput(ctx context.Context, metaData dfMetaData) error {
return errors.Wrapf(err, "error getting verbose output of images")
}
os.Stderr.WriteString("Images space usage:\n\n")
- out := formats.StdoutTemplateArray{Output: systemDfImageVerboseDiskUsageToGeneric(imagesVerboseDiskUsage), Template: "table {{.Repository}}\t{{.Tag}}\t{{.ImageID}}\t{{.Created}}\t{{.Size}}\t{{.SharedSize}}\t{{.UniqueSize}}\t{{.Containers}}", Fields: imageVerboseHeader}
+ out := formats.StdoutTemplateArray{Output: systemDfImageVerboseDiskUsageToGeneric(imagesVerboseDiskUsage), Template: imageVerboseFormat, Fields: imageVerboseHeader}
formats.Writer(out).Out()
return nil
}
@@ -569,7 +572,7 @@ func containersVerboseOutput(ctx context.Context, metaData dfMetaData) error {
return errors.Wrapf(err, "error getting verbose output of containers")
}
os.Stderr.WriteString("\nContainers space usage:\n\n")
- out := formats.StdoutTemplateArray{Output: systemDfContainerVerboseDiskUsageToGeneric(containersVerboseDiskUsage), Template: "table {{.ContainerID}}\t{{.Image}}\t{{.Command}}\t{{.LocalVolumes}}\t{{.Size}}\t{{.Created}}\t{{.Status}}\t{{.Names}}", Fields: containerVerboseHeader}
+ out := formats.StdoutTemplateArray{Output: systemDfContainerVerboseDiskUsageToGeneric(containersVerboseDiskUsage), Template: containerVerboseFormat, Fields: containerVerboseHeader}
formats.Writer(out).Out()
return nil
}
@@ -585,7 +588,7 @@ func volumesVerboseOutput(ctx context.Context, metaData dfMetaData) error {
return errors.Wrapf(err, "error getting verbose ouput of volumes")
}
os.Stderr.WriteString("\nLocal Volumes space usage:\n\n")
- out := formats.StdoutTemplateArray{Output: systemDfVolumeVerboseDiskUsageToGeneric(volumesVerboseDiskUsage), Template: "table {{.VolumeName}}\t{{.Links}}\t{{.Size}}", Fields: volumeVerboseHeader}
+ out := formats.StdoutTemplateArray{Output: systemDfVolumeVerboseDiskUsageToGeneric(volumesVerboseDiskUsage), Template: volumeVerboseFormat, Fields: volumeVerboseHeader}
formats.Writer(out).Out()
return nil
}