Skip to content

Commit

Permalink
[release-18.0] Bypass cobra completion commands so they still function (
Browse files Browse the repository at this point in the history
#14217) (#14234)

Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
  • Loading branch information
vitess-bot[bot] authored Oct 12, 2023
1 parent 9f240c7 commit fe31219
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 @@ -141,6 +141,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 fe31219

Please sign in to comment.