summaryrefslogtreecommitdiff
path: root/cmd/kpod/images.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2017-12-12 11:33:28 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-12 21:53:53 +0000
commitcfb4e15e430e63b17420e80c0f6030a12fa1fb4a (patch)
treef740bb59926d7f33da5cb21162614300a18b9598 /cmd/kpod/images.go
parent39b697d9afb4f4a08f16eee58690e61c897bf1aa (diff)
downloadpodman-cfb4e15e430e63b17420e80c0f6030a12fa1fb4a.tar.gz
podman-cfb4e15e430e63b17420e80c0f6030a12fa1fb4a.tar.bz2
podman-cfb4e15e430e63b17420e80c0f6030a12fa1fb4a.zip
\t was not being recognized as tab in --format
When doing kpod images --format "{{.ID}}\t{{.Tag}}" the "\t" was being passed in as a string of "\" and "t" instead of as a tab character. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #123 Approved by: rhatdan
Diffstat (limited to 'cmd/kpod/images.go')
-rw-r--r--cmd/kpod/images.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/kpod/images.go b/cmd/kpod/images.go
index 7b020c984..76f5ca69a 100644
--- a/cmd/kpod/images.go
+++ b/cmd/kpod/images.go
@@ -93,12 +93,7 @@ func imagesCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- var format string
- if c.IsSet("format") {
- format = c.String("format")
- } else {
- format = genImagesFormat(c.Bool("quiet"), c.Bool("noheading"), c.Bool("digests"))
- }
+ format := genImagesFormat(c.String("format"), c.Bool("quiet"), c.Bool("noheading"), c.Bool("digests"))
opts := imagesOptions{
quiet: c.Bool("quiet"),
@@ -137,7 +132,12 @@ func imagesCmd(c *cli.Context) error {
return generateImagesOutput(runtime, images, opts)
}
-func genImagesFormat(quiet, noHeading, digests bool) (format string) {
+func genImagesFormat(format string, quiet, noHeading, digests bool) 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"
+ return strings.Replace(format, `\t`, "\t", -1)
+ }
if quiet {
return formats.IDString
}
@@ -149,7 +149,7 @@ func genImagesFormat(quiet, noHeading, digests bool) (format string) {
format += "{{.Digest}}\t"
}
format += "{{.ID}}\t{{.Created}}\t{{.Size}}\t"
- return
+ return format
}
// imagesToGeneric creates an empty array of interfaces for output