mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
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>
This commit is contained in:
@ -24,6 +24,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
cidTruncLength = 12
|
cidTruncLength = 12
|
||||||
podTruncLength = 12
|
podTruncLength = 12
|
||||||
|
cmdTruncLength = 17
|
||||||
)
|
)
|
||||||
|
|
||||||
// PsOptions describes the struct being formed for ps
|
// PsOptions describes the struct being formed for ps
|
||||||
@ -191,9 +192,12 @@ func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput
|
|||||||
pod := ctr.PodID()
|
pod := ctr.PodID()
|
||||||
if !opts.NoTrunc {
|
if !opts.NoTrunc {
|
||||||
cid = cid[0:cidTruncLength]
|
cid = cid[0:cidTruncLength]
|
||||||
if len(pod) > 12 {
|
if len(pod) > podTruncLength {
|
||||||
pod = pod[0:podTruncLength]
|
pod = pod[0:podTruncLength]
|
||||||
}
|
}
|
||||||
|
if len(command) > cmdTruncLength {
|
||||||
|
command = command[0:cmdTruncLength] + "..."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pso.ID = cid
|
pso.ID = cid
|
||||||
|
Reference in New Issue
Block a user