From 0d8f87a6a3e8d64c85e53e288fb9a53c73868425 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Tue, 31 Jul 2018 19:03:15 -0400 Subject: [PATCH] Break command and args in description by newline Inline scripts may use newlines in these fields, and properly indenting makes the output more readable: ``` Command: /bin/bash -c #!/bin/bash echo "inline script should be indented" ``` --- pkg/printers/internalversion/describe.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/printers/internalversion/describe.go b/pkg/printers/internalversion/describe.go index 1e27451bea..f9399173bf 100644 --- a/pkg/printers/internalversion/describe.go +++ b/pkg/printers/internalversion/describe.go @@ -1469,13 +1469,17 @@ func describeContainerCommand(container api.Container, w PrefixWriter) { if len(container.Command) > 0 { w.Write(LEVEL_2, "Command:\n") for _, c := range container.Command { - w.Write(LEVEL_3, "%s\n", c) + for _, s := range strings.Split(c, "\n") { + w.Write(LEVEL_3, "%s\n", s) + } } } if len(container.Args) > 0 { w.Write(LEVEL_2, "Args:\n") for _, arg := range container.Args { - w.Write(LEVEL_3, "%s\n", arg) + for _, s := range strings.Split(arg, "\n") { + w.Write(LEVEL_3, "%s\n", s) + } } } }