X Tutup
Skip to content

Commit 6cf6bb4

Browse files
committed
Disable auth for cobra shell request completion hidden commands
Those hidden command are used by the shell completion scripts, but they are not disabled auth check. Thus, the shell completion does not work even the completion setup was done properly. Fixes cli#4188
1 parent a94cadc commit 6cf6bb4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/cmdutil/auth_check.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ func CheckAuth(cfg config.Config) bool {
3434
}
3535

3636
func IsAuthCheckEnabled(cmd *cobra.Command) bool {
37-
if cmd.Name() == "help" {
37+
switch cmd.Name() {
38+
case "help", cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd:
3839
return false
3940
}
41+
4042
for c := cmd; c.Parent() != nil; c = c.Parent() {
4143
if c.Annotations != nil && c.Annotations["skipAuthCheck"] == "true" {
4244
return false

0 commit comments

Comments
 (0)
X Tutup