MCPcopy
hub / github.com/larksuite/cli / findCommand

Function findCommand

cmd/build_test.go:29–46  ·  view source on GitHub ↗
(root *cobra.Command, path string)

Source from the content-addressed store, hash-verified

27}
28
29func findCommand(root *cobra.Command, path string) *cobra.Command {
30 parts := strings.Fields(path)
31 cmd := root
32 for _, part := range parts {
33 var next *cobra.Command
34 for _, child := range cmd.Commands() {
35 if child.Name() == part {
36 next = child
37 break
38 }
39 }
40 if next == nil {
41 return nil
42 }
43 cmd = next
44 }
45 return cmd
46}

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected