| 524 | } |
| 525 | |
| 526 | func shouldSkipUpdateCheck(cmd *cobra.Command) bool { |
| 527 | if cmd == nil { |
| 528 | return false |
| 529 | } |
| 530 | |
| 531 | for current := cmd; current != nil; current = current.Parent() { |
| 532 | switch current.Name() { |
| 533 | case "help", "completion", "version": |
| 534 | return true |
| 535 | } |
| 536 | |
| 537 | if current.Annotations != nil && current.Annotations["skipUpdateCheck"] == "true" { |
| 538 | return true |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | if helpFlag := cmd.Flags().Lookup("help"); helpFlag != nil && helpFlag.Changed { |
| 543 | return true |
| 544 | } |
| 545 | |
| 546 | return false |
| 547 | } |