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

Function executeCommandWithContextC

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

Source from the content-addressed store, hash-verified

57}
58
59func executeCommandWithContextC(ctx context.Context, root *Command, args ...string) (c *Command, output string, err error) {
60 buf := new(bytes.Buffer)
61 root.SetOut(buf)
62 root.SetErr(buf)
63 root.SetArgs(args)
64
65 c, err = root.ExecuteContextC(ctx)
66
67 return c, buf.String(), err
68}
69
70func resetCommandLineFlagSet() {
71 pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ExitOnError)

Callers 2

TestExecuteContextCFunction · 0.85

Calls 5

SetOutMethod · 0.80
SetErrMethod · 0.80
SetArgsMethod · 0.80
ExecuteContextCMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected