diff options
author | baude <bbaude@redhat.com> | 2018-10-30 08:17:04 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2018-10-30 08:35:22 -0500 |
commit | aa49675e294f075ae98141327246ec08ae84b512 (patch) | |
tree | 230cc7586cf8d333680f27b915a65cf587e72a6b /cmd/podman/shared | |
parent | 24d4f114ea180ffae63c8a9a92049e4b873f6f5c (diff) | |
download | podman-aa49675e294f075ae98141327246ec08ae84b512.tar.gz podman-aa49675e294f075ae98141327246ec08ae84b512.tar.bz2 podman-aa49675e294f075ae98141327246ec08ae84b512.zip |
truncate command output in ps by default
when the PS command was reworked for performance and formatting improvements,
i forgot to truncate the command field. Long container commands was throwing
the formatting off. we now truncated to 17 characters plus the elipses.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/shared')
-rw-r--r-- | cmd/podman/shared/container.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index b847314a4..4404268d4 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -24,6 +24,7 @@ import ( const ( cidTruncLength = 12 podTruncLength = 12 + cmdTruncLength = 17 ) // PsOptions describes the struct being formed for ps @@ -191,9 +192,12 @@ func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput pod := ctr.PodID() if !opts.NoTrunc { cid = cid[0:cidTruncLength] - if len(pod) > 12 { + if len(pod) > podTruncLength { pod = pod[0:podTruncLength] } + if len(command) > cmdTruncLength { + command = command[0:cmdTruncLength] + "..." + } } pso.ID = cid |