Merge pull request #4189 from cuonglm/issue-4188

Disable auth for cobra shell request completion hidden commands
This commit is contained in:
Mislav Marohnić 2021-08-24 20:48:46 +02:00 committed by GitHub
commit 355d28195e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,9 +34,11 @@ func CheckAuth(cfg config.Config) bool {
}
func IsAuthCheckEnabled(cmd *cobra.Command) bool {
if cmd.Name() == "help" {
switch cmd.Name() {
case "help", cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd:
return false
}
for c := cmd; c.Parent() != nil; c = c.Parent() {
if c.Annotations != nil && c.Annotations["skipAuthCheck"] == "true" {
return false