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" ```
parent 99133f51
...@@ -1469,13 +1469,17 @@ func describeContainerCommand(container api.Container, w PrefixWriter) { ...@@ -1469,13 +1469,17 @@ func describeContainerCommand(container api.Container, w PrefixWriter) {
if len(container.Command) > 0 { if len(container.Command) > 0 {
w.Write(LEVEL_2, "Command:\n") w.Write(LEVEL_2, "Command:\n")
for _, c := range container.Command { 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 { if len(container.Args) > 0 {
w.Write(LEVEL_2, "Args:\n") w.Write(LEVEL_2, "Args:\n")
for _, arg := range container.Args { 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)
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment