(cmd *Command, name string)
| 927 | } |
| 928 | |
| 929 | func findFlag(cmd *Command, name string) *pflag.Flag { |
| 930 | flagSet := cmd.Flags() |
| 931 | if len(name) == 1 { |
| 932 | // First convert the short flag into a long flag |
| 933 | // as the cmd.Flag() search only accepts long flags |
| 934 | if short := flagSet.ShorthandLookup(name); short != nil { |
| 935 | name = short.Name |
| 936 | } else { |
| 937 | set := cmd.InheritedFlags() |
| 938 | if short = set.ShorthandLookup(name); short != nil { |
| 939 | name = short.Name |
| 940 | } else { |
| 941 | return nil |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | return cmd.Flag(name) |
| 946 | } |
| 947 | |
| 948 | // CompDebug prints the specified string to the same file as where the |
| 949 | // completion script prints its logs. |
no test coverage detected