podman ps command string too long

The default outout for podman ps should limit itself if the command is long. If the command
is more than 20 characters, we truncate the command and add an elipses to it.

Resolves: #464

Signed-off-by: baude <bbaude@redhat.com>

Closes: #466
Approved by: rhatdan
This commit is contained in:
baude 2018-03-08 13:04:44 -06:00 committed by Atomic Bot
parent 713c08630b
commit 984dfecb2c
1 changed files with 6 additions and 0 deletions

View File

@ -435,6 +435,11 @@ func getTemplateOutput(containers []*libpod.Container, opts psOptions) ([]psTemp
}
command := strings.Join(batchInfo.conConfig.Spec.Process.Args, " ")
if !opts.noTrunc {
if len(command) > 20 {
command = command[:19] + "..."
}
}
ports := portsToString(batchInfo.conConfig.PortMappings)
mounts := getMounts(createArtifact.Volumes, opts.noTrunc)
labels := formatLabels(ctr.Labels())
@ -471,6 +476,7 @@ func getTemplateOutput(containers []*libpod.Container, opts psOptions) ([]psTemp
Mounts: mounts,
PID: batchInfo.pid,
}
if opts.namespace {
params.Cgroup = ns.Cgroup
params.IPC = ns.IPC