From 0d9f190280f65a5441b113316304a740931e22d4 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 28 Apr 2022 18:09:20 +0200 Subject: 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 --- cmd/podman/machine/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/podman/machine/list.go') diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go index 587e521a3..c987bf71a 100644 --- a/cmd/podman/machine/list.go +++ b/cmd/podman/machine/list.go @@ -69,7 +69,7 @@ func init() { flags := lsCmd.Flags() formatFlagName := "format" flags.StringVar(&listFlag.format, formatFlagName, "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\t{{.DiskSize}}\n", "Format volume output using JSON or a Go template") - _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(machineReporter{})) + _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&machineReporter{})) flags.BoolVar(&listFlag.noHeading, "noheading", false, "Do not print headers") flags.BoolVarP(&listFlag.quiet, "quiet", "q", false, "Show only machine names") } -- cgit v1.2.3-54-g00ecf