MCPcopy Create free account
hub / github.com/compozy/agh / ExecuteContext

Function ExecuteContext

internal/cli/root.go:174–184  ·  view source on GitHub ↗
(ctx context.Context, args []string, stdout io.Writer, stderr io.Writer)

Source from the content-addressed store, hash-verified

172}
173
174func ExecuteContext(ctx context.Context, args []string, stdout io.Writer, stderr io.Writer) int {
175 cmd := NewRootCommand()
176 cmd.SetArgs(args)
177 cmd.SetOut(stdout)
178 cmd.SetErr(stderr)
179
180 if err := cmd.ExecuteContext(ctx); err != nil {
181 return writeExecutionError(stderr, args, err)
182 }
183 return 0
184}
185
186func writeExecutionError(stderr io.Writer, args []string, err error) int {
187 exitCode := cliExitCodeForError(err)

Callers 3

runFunction · 0.92
runFunction · 0.92

Calls 2

NewRootCommandFunction · 0.85
writeExecutionErrorFunction · 0.85

Tested by 1