From 12e3d9d8a26d2c33d587dba9b7ea5b0dcfd92eea Mon Sep 17 00:00:00 2001 From: umohnani8 Date: Tue, 23 Jan 2018 16:50:20 -0500 Subject: Fix podman stats based on QE feedback QE found issues with formatting the go template and the man page was lacking information. Changed the format of the output to match latest docker. Add shortID function that returns the truncated ID Signed-off-by: umohnani8 Closes: #258 Approved by: rhatdan --- cmd/podman/common.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'cmd/podman/common.go') diff --git a/cmd/podman/common.go b/cmd/podman/common.go index ae4bbd65d..921f30b84 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -22,7 +22,10 @@ var ( } ) -const crioConfigPath = "/etc/crio/crio.conf" +const ( + crioConfigPath = "/etc/crio/crio.conf" + idTruncLength = 12 +) func getRuntime(c *cli.Context) (*libpod.Runtime, error) { @@ -88,6 +91,13 @@ func splitCamelCase(src string) string { return strings.Join(entries, " ") } +func shortID(id string) string { + if len(id) > idTruncLength { + return id[:idTruncLength] + } + return id +} + // validateFlags searches for StringFlags or StringSlice flags that never had // a value set. This commonly occurs when the CLI mistakenly takes the next // option and uses it as a value. -- cgit v1.2.3-54-g00ecf