mirror of
https://github.com/clearlinux/docker.git
synced 2026-11-21 13:32:48 +00:00
Fix "docker ps" with no containers regression
The header row was not being printed when "docker ps" was invoked without containers thanks to the new format support, and we instead received a single blank line. Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
This commit is contained in:
@@ -191,6 +191,13 @@ func customFormat(ctx Context, containers []types.Container) {
|
||||
}
|
||||
|
||||
if table {
|
||||
if len(header) == 0 {
|
||||
// if we still don't have a header, we didn't have any containers so we need to fake it to get the right headers from the template
|
||||
containerCtx := &containerContext{}
|
||||
tmpl.Execute(bytes.NewBufferString(""), containerCtx)
|
||||
header = containerCtx.fullHeader()
|
||||
}
|
||||
|
||||
t := tabwriter.NewWriter(ctx.Output, 20, 1, 3, ' ', 0)
|
||||
t.Write([]byte(header))
|
||||
t.Write([]byte("\n"))
|
||||
|
||||
Reference in New Issue
Block a user