MCPcopy
hub / github.com/spf13/cobra / executeCommandWithContext

Function executeCommandWithContext

command_test.go:37–46  ·  view source on GitHub ↗
(ctx context.Context, root *Command, args ...string)

Source from the content-addressed store, hash-verified

35}
36
37func executeCommandWithContext(ctx context.Context, root *Command, args ...string) (output string, err error) {
38 buf := new(bytes.Buffer)
39 root.SetOut(buf)
40 root.SetErr(buf)
41 root.SetArgs(args)
42
43 err = root.ExecuteContext(ctx)
44
45 return buf.String(), err
46}
47
48func executeCommandC(root *Command, args ...string) (c *Command, output string, err error) {
49 buf := new(bytes.Buffer)

Callers 2

TestExecuteContextFunction · 0.85
TestHelpFuncExecutedFunction · 0.85

Calls 5

SetOutMethod · 0.80
SetErrMethod · 0.80
SetArgsMethod · 0.80
ExecuteContextMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected