diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-04-28 14:49:03 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-04-28 15:11:21 +0200 |
commit | f93ba587c608e2678b176f1460b32e8a144edf1a (patch) | |
tree | b2c6b5ce5b7e571b33fb77146ef4bf1c0d7c9162 /cmd/podman/pods | |
parent | 2b8cafc0671fbbd155770f044b8216f050877192 (diff) | |
download | podman-f93ba587c608e2678b176f1460b32e8a144edf1a.tar.gz podman-f93ba587c608e2678b176f1460b32e8a144edf1a.tar.bz2 podman-f93ba587c608e2678b176f1460b32e8a144edf1a.zip |
shell completion --format: work with nil structs
AutocompleteFormat() takes the format struct as argument. Often the structs
are deeply nested and contain other structs. Up until now if there was a
pointer to a struct the logic was not able to get the field names from
that, simply because the pointer was nil. However it is possible to
create a new initialized type with reflect.New(). This allows us to
complete all struct fields/functions even when there nil pointers.
Therefore we can drop the extra initialization which was done by some
callers.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r-- | cmd/podman/pods/ps.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go index 4a049541a..8cbf7b0ba 100644 --- a/cmd/podman/pods/ps.go +++ b/cmd/podman/pods/ps.go @@ -57,7 +57,7 @@ func init() { formatFlagName := "format" flags.StringVar(&psInput.Format, formatFlagName, "", "Pretty-print pods to JSON or using a Go template") - _ = psCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(ListPodReporter{ListPodsReport: &entities.ListPodsReport{}})) + _ = psCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(ListPodReporter{})) flags.Bool("noheading", false, "Do not print headers") flags.BoolVar(&psInput.Namespace, "namespace", false, "Display namespace information of the pod") |