diff --git a/cli/command/container/completion.go b/cli/command/container/completion.go index 9103c05c8b..914de4e84d 100644 --- a/cli/command/container/completion.go +++ b/cli/command/container/completion.go @@ -197,7 +197,7 @@ func completeDetachKeys(_ *cobra.Command, _ []string, _ string) ([]string, cobra // The completion is partly composite. func completeIpc(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic + if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic // not swapped, matches partly typed "container" return []string{"container:"}, cobra.ShellCompDirectiveNoSpace } if strings.HasPrefix(toComplete, "container:") { @@ -237,7 +237,7 @@ func completeLogOpt(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.S // completePid implements shell completion for the `--pid` option of `run` and `create`. func completePid(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic + if len(toComplete) > 0 && strings.HasPrefix("container", toComplete) { //nolint:gocritic // not swapped, matches partly typed "container" return []string{"container:"}, cobra.ShellCompDirectiveNoSpace } if strings.HasPrefix(toComplete, "container:") { @@ -251,10 +251,10 @@ func completePid(dockerCLI completion.APIClientProvider) func(cmd *cobra.Command // completeSecurityOpt implements shell completion for the `--security-opt` option of `run` and `create`. // The completion is partly composite. func completeSecurityOpt(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(toComplete) > 0 && strings.HasPrefix("apparmor=", toComplete) { //nolint:gocritic + if len(toComplete) > 0 && strings.HasPrefix("apparmor=", toComplete) { //nolint:gocritic // not swapped, matches partly typed "apparmor=" return []string{"apparmor="}, cobra.ShellCompDirectiveNoSpace } - if len(toComplete) > 0 && strings.HasPrefix("label", toComplete) { //nolint:gocritic + if len(toComplete) > 0 && strings.HasPrefix("label", toComplete) { //nolint:gocritic // not swapped, matches partly typed "label" return []string{"label="}, cobra.ShellCompDirectiveNoSpace } if strings.HasPrefix(toComplete, "label=") { @@ -265,7 +265,7 @@ func completeSecurityOpt(_ *cobra.Command, _ []string, toComplete string) ([]str return prefixWith("label=", labels), cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp } // length must be > 1 here so that completion of "s" falls through. - if len(toComplete) > 1 && strings.HasPrefix("seccomp", toComplete) { //nolint:gocritic + if len(toComplete) > 1 && strings.HasPrefix("seccomp", toComplete) { //nolint:gocritic // not swapped, matches partly typed "seccomp" return []string{"seccomp="}, cobra.ShellCompDirectiveNoSpace } if strings.HasPrefix(toComplete, "seccomp=") {