aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2019-03-26 09:36:17 -0400
committerQi Wang <qiwan@redhat.com>2019-03-28 09:13:40 -0400
commit2729695892aeb9e3b4a333e4983c6db81e68a27a (patch)
tree9640ee4698ab5958faa715ab637bbbbb9560b564 /cmd
parent340eeec1b654880f9d339c9ac2957bcaeaee6829 (diff)
downloadpodman-2729695892aeb9e3b4a333e4983c6db81e68a27a.tar.gz
podman-2729695892aeb9e3b4a333e4983c6db81e68a27a.tar.bz2
podman-2729695892aeb9e3b4a333e4983c6db81e68a27a.zip
fix bug `system df` add blank space to the output
fix typo in Containers space usage: of podman system df -v, add a space for created time Change format string to const Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'cmd')
-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 183c5a7dd..7310a1e72 100644
--- a/cmd/podman/system_df.go
+++ b/cmd/podman/system_df.go
@@ -84,6 +84,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
@@ -472,7 +475,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),
@@ -501,7 +504,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(),
}
@@ -547,7 +550,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
}
@@ -568,7 +571,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
}
@@ -584,7 +587,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
}