(root *cobra.Command, path string)
| 27 | } |
| 28 | |
| 29 | func 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 | } |
no test coverage detected