MCPcopy Create free account
hub / github.com/52funny/pikpakcli / resolveCommand

Function resolveCommand

internal/shell/shell.go:1091–1114  ·  view source on GitHub ↗
(rootCmd *cobra.Command, tokens []string)

Source from the content-addressed store, hash-verified

1089}
1090
1091func 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
1116func completeFromPrefix(prefix string, candidates []string, appendSpace bool) ([][]rune, int) {
1117 matches := make([]string, 0)

Callers 3

DoMethod · 0.85
adaptShellArgsFunction · 0.85
expandShellGlobsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected