diff options
Diffstat (limited to 'cmd/podman/common')
-rw-r--r-- | cmd/podman/common/completion.go | 9 | ||||
-rw-r--r-- | cmd/podman/common/create.go | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go index abb943942..c7d5d6d60 100644 --- a/cmd/podman/common/completion.go +++ b/cmd/podman/common/completion.go @@ -327,7 +327,7 @@ func suffixCompSlice(suf string, slice []string) []string { if len(split) > 1 { slice[i] = split[0] + suf + "\t" + split[1] } else { - slice[i] = slice[i] + suf + slice[i] += suf } } return slice @@ -647,7 +647,10 @@ func AutocompleteInspect(cmd *cobra.Command, args []string, toComplete string) ( pods, _ := getPods(cmd, toComplete, completeDefault) networks, _ := getNetworks(cmd, toComplete, completeDefault) volumes, _ := getVolumes(cmd, toComplete) - suggestions := append(containers, images...) + + suggestions := make([]string, 0, len(containers)+len(images)+len(pods)+len(networks)+len(volumes)) + suggestions = append(suggestions, containers...) + suggestions = append(suggestions, images...) suggestions = append(suggestions, pods...) suggestions = append(suggestions, networks...) suggestions = append(suggestions, volumes...) @@ -961,6 +964,8 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t // this function provides shell completion for go templates return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { // autocomplete json when nothing or json is typed + // gocritic complains about the argument order but this is correct in this case + //nolint:gocritic if strings.HasPrefix("json", toComplete) { return []string{"json"}, cobra.ShellCompDirectiveNoFileComp } diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index 62c9f4c9a..1c1a7c3e3 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -896,7 +896,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions, ) _ = cmd.RegisterFlagCompletionFunc(memorySwappinessFlagName, completion.AutocompleteNone) } - //anyone can use these + // anyone can use these cpusFlagName := "cpus" createFlags.Float64Var( &cf.CPUS, |