(rootCmd *cobra.Command, tokens []string)
| 1089 | } |
| 1090 | |
| 1091 | func resolveCommand(rootCmd *cobra.Command, tokens []string) (*cobra.Command, int) { |
| 1092 | current := rootCmd |
| 1093 | consumed := 0 |
| 1094 | |
| 1095 | for _, token := range tokens { |
| 1096 | matched := false |
| 1097 | for _, sub := range current.Commands() { |
| 1098 | if sub.Hidden { |
| 1099 | continue |
| 1100 | } |
| 1101 | if token == sub.Name() || slices.Contains(sub.Aliases, token) { |
| 1102 | current = sub |
| 1103 | consumed++ |
| 1104 | matched = true |
| 1105 | break |
| 1106 | } |
| 1107 | } |
| 1108 | if !matched { |
| 1109 | break |
| 1110 | } |
| 1111 | } |
| 1112 | |
| 1113 | return current, consumed |
| 1114 | } |
| 1115 | |
| 1116 | func completeFromPrefix(prefix string, candidates []string, appendSpace bool) ([][]rune, int) { |
| 1117 | matches := make([]string, 0) |
no outgoing calls
no test coverage detected