summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/ps.go20
-rw-r--r--cmd/podman/shared/container.go6
2 files changed, 10 insertions, 16 deletions
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index d63618e58..83274c9a8 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -329,16 +329,12 @@ func psCmd(c *cli.Context) error {
}
// Define a tab writer with stdout as the output
- w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
+ w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
defer w.Flush()
// Output standard PS headers
if !opts.Namespace {
- fmt.Fprintf(w, "\n%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, himage, hcommand, hcreated, hstatus, hports, hnames)
- // If the user does not want size OR pod info, we print the isInfra bool
- if !opts.Size && !opts.Pod {
- fmt.Fprintf(w, "\t%s", hinfra)
- }
+ fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, himage, hcommand, hcreated, hstatus, hports, hnames)
// User wants pod info
if opts.Pod {
fmt.Fprintf(w, "\t%s", hpod)
@@ -349,22 +345,15 @@ func psCmd(c *cli.Context) error {
}
} else {
// Output Namespace headers
- fmt.Fprintf(w, "\n%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, hnames, nspid, nscgroup, nsipc, nsmnt, nsnet, nspidns, nsuserns, nsuts)
- }
- if len(pss) == 0 {
- fmt.Fprint(w, "\n")
+ fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s", hid, hnames, nspid, nscgroup, nsipc, nsmnt, nsnet, nspidns, nsuserns, nsuts)
}
+
// Now iterate each container and output its information
for _, container := range pss {
// Standard PS output
if !opts.Namespace {
fmt.Fprintf(w, "\n%s\t%s\t%s\t%s\t%s\t%s\t%s", container.ID, container.Image, container.Command, container.Created, container.Status, container.Ports, container.Names)
-
- // If not size and not pod info, do isInfra
- if !opts.Size && !opts.Pod {
- fmt.Fprintf(w, "\t%t", container.IsInfra)
- }
// User wants pod info
if opts.Pod {
fmt.Fprintf(w, "\t%s", container.Pod)
@@ -387,6 +376,7 @@ func psCmd(c *cli.Context) error {
}
}
+ fmt.Fprint(w, "\n")
return nil
}
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