cli: remove HasCompletionArg utility

It was only used in a single place and has no external consumers.
Move it to where it's used to keep things together.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-08-15 14:21:47 +02:00
parent 53b6fddced
commit 5a99022556
2 changed files with 11 additions and 11 deletions
-10
View File
@@ -185,16 +185,6 @@ func DisableFlagsInUseLine(cmd *cobra.Command) {
})
}
// HasCompletionArg returns true if a cobra completion arg request is found.
func HasCompletionArg(args []string) bool {
for _, arg := range args {
if arg == cobra.ShellCompRequestCmd || arg == cobra.ShellCompNoDescRequestCmd {
return true
}
}
return false
}
var helpCommand = &cobra.Command{
Use: "help [command]",
Short: "Help about the command",
+11 -1
View File
@@ -451,7 +451,7 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
return err
}
if cli.HasCompletionArg(args) {
if hasCompletionArg(args) {
// We add plugin command stubs early only for completion. We don't
// want to add them for normal command execution as it would cause
// a significant performance hit.
@@ -504,6 +504,16 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
return err
}
// hasCompletionArg returns true if a cobra completion arg request is found.
func hasCompletionArg(args []string) bool {
for _, arg := range args {
if arg == cobra.ShellCompRequestCmd || arg == cobra.ShellCompNoDescRequestCmd {
return true
}
}
return false
}
type versionDetails interface {
CurrentVersion() string
ServerInfo() command.ServerInfo