Skip to content

Commit

Permalink
Bypass cobra completion commands so they still function (#14217)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Mason authored Oct 10, 2023
1 parent f119796 commit 824c8e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions go/cmd/vtctldclient/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ func getClientForCommand(cmd *cobra.Command) (vtctldclient.VtctldClient, error)
}
}

// Reserved cobra commands for shell completion that we don't want to fail
// here.
switch {
case cmd.Name() == "__complete", cmd.Parent() != nil && cmd.Parent().Name() == "completion":
return nil, nil
}

if VtctldClientProtocol != "local" && server == "" {
return nil, errNoServer
}
Expand Down

0 comments on commit 824c8e9

Please sign in to comment.