summaryrefslogtreecommitdiff
path: root/cmd/podman/volumes/list.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-28 15:25:16 +0200
committerGitHub <noreply@github.com>2020-04-28 15:25:16 +0200
commite9a1726f50565d633edf87a88ca6960ea075d50f (patch)
tree1daa41f3e7a474b138f4590929f2b44a06bcd62c /cmd/podman/volumes/list.go
parentf079b4ee5ea9673f8697fbf9120ff24b4f16b07f (diff)
parente78e66c5b9a103f577df155b3f61130cfc718d0f (diff)
downloadpodman-e9a1726f50565d633edf87a88ca6960ea075d50f.tar.gz
podman-e9a1726f50565d633edf87a88ca6960ea075d50f.tar.bz2
podman-e9a1726f50565d633edf87a88ca6960ea075d50f.zip
Merge pull request #6007 from baude/v2intvolumes
enable volume integration tests
Diffstat (limited to 'cmd/podman/volumes/list.go')
-rw-r--r--cmd/podman/volumes/list.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index f75de6b4b..7f5a55b14 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -2,6 +2,7 @@ package volumes
import (
"context"
+ "fmt"
"html/template"
"io"
"os"
@@ -57,6 +58,9 @@ func list(cmd *cobra.Command, args []string) error {
if cliOpts.Quiet && cmd.Flag("format").Changed {
return errors.New("quiet and format flags cannot be used together")
}
+ if len(cliOpts.Filter) > 0 {
+ lsOpts.Filter = make(map[string][]string)
+ }
for _, f := range cliOpts.Filter {
filterSplit := strings.Split(f, "=")
if len(filterSplit) < 2 {
@@ -68,6 +72,10 @@ func list(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
+ if cliOpts.Format == "json" {
+ return outputJSON(responses)
+ }
+
if len(responses) < 1 {
return nil
}
@@ -99,3 +107,12 @@ func list(cmd *cobra.Command, args []string) error {
}
return nil
}
+
+func outputJSON(vols []*entities.VolumeListReport) error {
+ b, err := json.MarshalIndent(vols, "", " ")
+ if err != nil {
+ return err
+ }
+ fmt.Println(string(b))
+ return nil
+}