github.com/containers/podman/v4@v4.9.4/test/testvol/list.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/spf13/cobra" 7 ) 8 9 var listCmd = &cobra.Command{ 10 Use: "list", 11 Short: "list all volumes", 12 Long: `List all volumes from the volume plugin listening on --sock-name`, 13 Args: cobra.NoArgs, 14 RunE: func(cmd *cobra.Command, args []string) error { 15 return listVol(config.sockName) 16 }, 17 } 18 19 func listVol(sockName string) error { 20 plugin, err := getPlugin(sockName) 21 if err != nil { 22 return err 23 } 24 vols, err := plugin.ListVolumes() 25 if err != nil { 26 return err 27 } 28 for _, vol := range vols { 29 fmt.Println(vol.Name) 30 } 31 return nil 32 }