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

Method ExecuteContext

command.go:1062–1065  ·  view source on GitHub ↗

ExecuteContext is the same as Execute(), but sets the ctx on the command. Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs functions.

(ctx context.Context)

Source from the content-addressed store, hash-verified

1060// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs
1061// functions.
1062func (c *Command) ExecuteContext(ctx context.Context) error {
1063 c.ctx = ctx
1064 return c.Execute()
1065}
1066
1067// Execute uses the args (os.Args[1:] by default)
1068// and run through the command tree finding appropriate matches

Callers 2

Calls 1

ExecuteMethod · 0.95

Tested by 2