MCPcopy Create free account
hub / github.com/crc-org/crc-cloud / attachMiddleware

Function attachMiddleware

cmd/cmd/root.go:60–70  ·  view source on GitHub ↗
(names []string, cmd *cobra.Command)

Source from the content-addressed store, hash-verified

58}
59
60func attachMiddleware(names []string, cmd *cobra.Command) {
61 if cmd.HasSubCommands() {
62 for _, command := range cmd.Commands() {
63 attachMiddleware(append(names, cmd.Name()), command)
64 }
65 } else if cmd.RunE != nil {
66 fullCmd := strings.Join(append(names, cmd.Name()), " ")
67 src := cmd.RunE
68 cmd.RunE = executeWithLogging(fullCmd, src)
69 }
70}
71
72func executeWithLogging(_ string, input func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string) error {
73 return func(cmd *cobra.Command, args []string) error {

Callers 1

ExecuteFunction · 0.85

Calls 1

executeWithLoggingFunction · 0.85

Tested by

no test coverage detected