|
@@ -170,9 +170,11 @@ func customFormat(ctx Context, containers []types.Container) {
|
|
format += "\t{{.Size}}"
|
|
format += "\t{{.Size}}"
|
|
}
|
|
}
|
|
|
|
|
|
- tmpl, err := template.New("ps template").Parse(format)
|
|
|
|
|
|
+ tmpl, err := template.New("").Parse(format)
|
|
if err != nil {
|
|
if err != nil {
|
|
- buffer.WriteString(fmt.Sprintf("Invalid `docker ps` format: %v\n", err))
|
|
|
|
|
|
+ buffer.WriteString(fmt.Sprintf("Template parsing error: %v\n", err))
|
|
|
|
+ buffer.WriteTo(ctx.Output)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
|
|
for _, container := range containers {
|
|
for _, container := range containers {
|
|
@@ -181,8 +183,9 @@ func customFormat(ctx Context, containers []types.Container) {
|
|
c: container,
|
|
c: container,
|
|
}
|
|
}
|
|
if err := tmpl.Execute(buffer, containerCtx); err != nil {
|
|
if err := tmpl.Execute(buffer, containerCtx); err != nil {
|
|
- buffer = bytes.NewBufferString(fmt.Sprintf("Invalid `docker ps` format: %v\n", err))
|
|
|
|
- break
|
|
|
|
|
|
+ buffer = bytes.NewBufferString(fmt.Sprintf("Template parsing error: %v\n", err))
|
|
|
|
+ buffer.WriteTo(ctx.Output)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
if table && len(header) == 0 {
|
|
if table && len(header) == 0 {
|
|
header = containerCtx.fullHeader()
|
|
header = containerCtx.fullHeader()
|