diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-04-28 18:09:20 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-04-28 18:12:17 +0200 |
commit | 0d9f190280f65a5441b113316304a740931e22d4 (patch) | |
tree | f29536f276f2239c95f9382fc44af9b99ae9c2c6 /cmd/podman/secrets | |
parent | cac2b7800b2fa9c037565373b28dfef5ff8dd59f (diff) | |
download | podman-0d9f190280f65a5441b113316304a740931e22d4.tar.gz podman-0d9f190280f65a5441b113316304a740931e22d4.tar.bz2 podman-0d9f190280f65a5441b113316304a740931e22d4.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/secrets')
-rw-r--r-- | cmd/podman/secrets/inspect.go | 2 | ||||
-rw-r--r-- | cmd/podman/secrets/list.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/cmd/podman/secrets/inspect.go b/cmd/podman/secrets/inspect.go index 0977434f7..e8947e441 100644 --- a/cmd/podman/secrets/inspect.go +++ b/cmd/podman/secrets/inspect.go @@ -36,7 +36,7 @@ func init() { flags := inspectCmd.Flags() formatFlagName := "format" flags.StringVar(&format, formatFlagName, "", "Format volume output using Go template") - _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.SecretInfoReport{})) + _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.SecretInfoReport{})) } func inspect(cmd *cobra.Command, args []string) error { diff --git a/cmd/podman/secrets/list.go b/cmd/podman/secrets/list.go index 2ef84cd48..558a16ccf 100644 --- a/cmd/podman/secrets/list.go +++ b/cmd/podman/secrets/list.go @@ -45,7 +45,7 @@ func init() { flags := lsCmd.Flags() formatFlagName := "format" flags.StringVar(&listFlag.format, formatFlagName, "{{.ID}}\t{{.Name}}\t{{.Driver}}\t{{.CreatedAt}}\t{{.UpdatedAt}}\t\n", "Format volume output using Go template") - _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(entities.SecretInfoReport{})) + _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.SecretInfoReport{})) filterFlagName := "filter" flags.StringSliceVarP(&listFlag.filter, filterFlagName, "f", []string{}, "Filter secret output") _ = lsCmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompleteSecretFilters) |