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
vitess-bot[bot] committed Oct 10, 2023
1 parent d63cea3 commit 595ab85
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 595ab85

Please sign in to comment.