summaryrefslogtreecommitdiff
path: root/cmd/podman/volumes
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-28 18:09:20 +0200
committerMatthew Heon <matthew.heon@pm.me>2022-05-03 13:41:54 -0400
commitd4fe645ed4f9af88d267b17b00cb717efc5880d2 (patch)
tree5d1641a493771d55fab7cd97b8557dcc82aa682f /cmd/podman/volumes
parent524b536101757e039bafa6dae74e4b45f2a5bd1f (diff)
downloadpodman-d4fe645ed4f9af88d267b17b00cb717efc5880d2.tar.gz
podman-d4fe645ed4f9af88d267b17b00cb717efc5880d2.tar.bz2
podman-d4fe645ed4f9af88d267b17b00cb717efc5880d2.zip
shell completion --format: use structs by reference
For the AutocompleteFormat function we expect the correct template struct which is used in the golang template. The function can handle both struct and pointer to a struct. Using the reference is more efficient since it doe snot have to copy the whole struct. Also change some structs to use he actual type from the template instead of some nested one to make sure it has to correct fields. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman/volumes')
-rw-r--r--cmd/podman/volumes/inspect.go2
-rw-r--r--cmd/podman/volumes/list.go3
2 files changed, 2 insertions, 3 deletions
diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go
index 2230a2818..f21f9c233 100644
--- a/cmd/podman/volumes/inspect.go
+++ b/cmd/podman/volumes/inspect.go
@@ -41,7 +41,7 @@ func init() {
formatFlagName := "format"
flags.StringVarP(&inspectOpts.Format, formatFlagName, "f", "json", "Format volume output using Go template")
- _ = inspectCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.InspectVolumeData{}))
+ _ = inspectCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&define.InspectVolumeData{}))
}
func volumeInspect(cmd *cobra.Command, args []string) error {
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index 2edf04097..c14cf08bd 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -11,7 +11,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/parse"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/validate"
- "github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -57,7 +56,7 @@ func init() {
formatFlagName := "format"
flags.StringVar(&cliOpts.Format, formatFlagName, "{{.Driver}}\t{{.Name}}\n", "Format volume output using Go template")
- _ = lsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.InspectVolumeData{}))
+ _ = lsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.VolumeListReport{}))
flags.Bool("noheading", false, "Do not print headers")
flags.BoolVarP(&cliOpts.Quiet, "quiet", "q", false, "Print volume output in quiet mode")