MCPcopy
hub / github.com/spf13/cobra / helpOrVersionFlagPresent

Function helpOrVersionFlagPresent

completions.go:584–594  ·  view source on GitHub ↗
(cmd *Command)

Source from the content-addressed store, hash-verified

582}
583
584func helpOrVersionFlagPresent(cmd *Command) bool {
585 if versionFlag := cmd.Flags().Lookup("version"); versionFlag != nil &&
586 len(versionFlag.Annotations[FlagSetByCobraAnnotation]) > 0 && versionFlag.Changed {
587 return true
588 }
589 if helpFlag := cmd.Flags().Lookup(helpFlagName); helpFlag != nil &&
590 len(helpFlag.Annotations[FlagSetByCobraAnnotation]) > 0 && helpFlag.Changed {
591 return true
592 }
593 return false
594}
595
596func getFlagNameCompletions(flag *pflag.Flag, toComplete string) []Completion {
597 if nonCompletableFlag(flag) {

Callers 1

getCompletionsMethod · 0.85

Calls 1

FlagsMethod · 0.80

Tested by

no test coverage detected