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:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user