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

Method SetContext

command.go:275–277  ·  view source on GitHub ↗

SetContext sets context for the command. This context will be overwritten by Command.ExecuteContext or Command.ExecuteContextC.

(ctx context.Context)

Source from the content-addressed store, hash-verified

273// SetContext sets context for the command. This context will be overwritten by
274// Command.ExecuteContext or Command.ExecuteContextC.
275func (c *Command) SetContext(ctx context.Context) {
276 c.ctx = ctx
277}
278
279// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
280// particularly useful when testing.

Callers 4

TestSetContextFunction · 0.95
TestSetContextPreRunFunction · 0.80

Calls

no outgoing calls

Tested by 4

TestSetContextFunction · 0.76
TestSetContextPreRunFunction · 0.64