Fix broken JSON support in cli/command/formatter
How to test (it should not print `{}`, and just returns JSON with the actual data):
$ docker images --format '{{json .}}'
$ docker container stats --format '{{json .}}'
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
@ -158,6 +158,10 @@ type diskUsageImagesContext struct {
|
||||
images []*types.ImageSummary
|
||||
}
|
||||
|
||||
func (c *diskUsageImagesContext) MarshalJSON() ([]byte, error) {
|
||||
return marshalJSON(c)
|
||||
}
|
||||
|
||||
func (c *diskUsageImagesContext) Type() string {
|
||||
c.AddHeader(typeHeader)
|
||||
return "Images"
|
||||
@ -209,6 +213,10 @@ type diskUsageContainersContext struct {
|
||||
containers []*types.Container
|
||||
}
|
||||
|
||||
func (c *diskUsageContainersContext) MarshalJSON() ([]byte, error) {
|
||||
return marshalJSON(c)
|
||||
}
|
||||
|
||||
func (c *diskUsageContainersContext) Type() string {
|
||||
c.AddHeader(typeHeader)
|
||||
return "Containers"
|
||||
@ -273,6 +281,10 @@ type diskUsageVolumesContext struct {
|
||||
volumes []*types.Volume
|
||||
}
|
||||
|
||||
func (c *diskUsageVolumesContext) MarshalJSON() ([]byte, error) {
|
||||
return marshalJSON(c)
|
||||
}
|
||||
|
||||
func (c *diskUsageVolumesContext) Type() string {
|
||||
c.AddHeader(typeHeader)
|
||||
return "Local Volumes"
|
||||
|
||||
Reference in New Issue
Block a user