validArgNames strips the "name\tdescription" form Cobra allows in ValidArgs, keeping only the value the user is expected to type. The split matches the one cobra.OnlyValidArgs applies, so the listed values are exactly those accepted.
(valid []string)
| 97 | // keeping only the value the user is expected to type. The split matches the one |
| 98 | // cobra.OnlyValidArgs applies, so the listed values are exactly those accepted. |
| 99 | func validArgNames(valid []string) []string { |
| 100 | names := make([]string, 0, len(valid)) |
| 101 | for _, v := range valid { |
| 102 | names = append(names, strings.SplitN(v, "\t", 2)[0]) |
| 103 | } |
| 104 | return names |
| 105 | } |
no outgoing calls