aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-01-26 10:29:12 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-27 08:25:54 +0000
commitb96887bcaa78e1072ccc1a06e57abafaed0a6bc6 (patch)
tree8b9565c752aae4e15b355e1c538c3b7292d34868 /cmd
parent3aa63b2b941aac40c5e3639b0880922b842052ab (diff)
downloadpodman-b96887bcaa78e1072ccc1a06e57abafaed0a6bc6.tar.gz
podman-b96887bcaa78e1072ccc1a06e57abafaed0a6bc6.tar.bz2
podman-b96887bcaa78e1072ccc1a06e57abafaed0a6bc6.zip
Fix tab issue with --format flag
When the Go template was given with \t in between fields, the \t was not being recognized as a tab. Fixes that issue. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #265 Approved by: rhatdan
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/stats.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go
index 21cca1d83..3c2dfb5cf 100644
--- a/cmd/podman/stats.go
+++ b/cmd/podman/stats.go
@@ -89,16 +89,9 @@ func statsCmd(c *cli.Context) error {
times = 1
}
- var format string
var ctrs []*libpod.Container
var containerFunc func() ([]*libpod.Container, error)
- if c.IsSet("format") {
- format = c.String("format")
- } else {
- format = genStatsFormat()
- }
-
containerFunc = runtime.GetRunningContainers
if len(c.Args()) > 0 {
containerFunc = func() ([]*libpod.Container, error) { return runtime.GetContainersByList(c.Args()) }
@@ -127,6 +120,9 @@ func statsCmd(c *cli.Context) error {
}
containerStats[ctr.ID()] = initialStats
}
+
+ format := genStatsFormat(c.String("format"))
+
step := 1
if times == -1 {
times = 1
@@ -183,7 +179,7 @@ func outputStats(stats []*libpod.ContainerStats, format string) error {
return formats.Writer(out).Out()
}
-func genStatsFormat() (format string) {
+func genStatsFormat(format string) string {
if format != "" {
// "\t" from the command line is not being recognized as a tab
// replacing the string "\t" to a tab character if the user passes in "\t"