aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/system/info.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-28 14:49:03 +0200
committerMatthew Heon <matthew.heon@pm.me>2022-05-03 13:41:27 -0400
commit68f7349bcd38c9633ebf3f21975046f14e75c803 (patch)
tree97381e8fdb1301a5071d85b1efd8b85575d211df /cmd/podman/system/info.go
parent07bc615b491836e88a331f8ab6e2ffdf34bc6905 (diff)
downloadpodman-68f7349bcd38c9633ebf3f21975046f14e75c803.tar.gz
podman-68f7349bcd38c9633ebf3f21975046f14e75c803.tar.bz2
podman-68f7349bcd38c9633ebf3f21975046f14e75c803.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/system/info.go')
-rw-r--r--cmd/podman/system/info.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index e95e9336d..87ceaa7cd 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -66,7 +66,7 @@ func infoFlags(cmd *cobra.Command) {
formatFlagName := "format"
flags.StringVarP(&inFormat, formatFlagName, "f", "", "Change the output format to JSON or a Go template")
- _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.Info{Host: &define.HostInfo{}, Store: &define.StoreInfo{}}))
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(define.Info{}))
}
func info(cmd *cobra.Command, args []string) error {