mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
Add Command.SetContext
This commit is contained in:
parent
9e1d6f1c2a
commit
ea4db7eef4
1 changed files with 6 additions and 0 deletions
|
@ -230,6 +230,12 @@ func (c *Command) Context() context.Context {
|
|||
return c.ctx
|
||||
}
|
||||
|
||||
// SetContext sets context for the command. It is set to context.Background by default and will be overwritten by
|
||||
// Command.ExecuteContext or Command.ExecuteContextC
|
||||
func (c *Command) SetContext(ctx context.Context) {
|
||||
c.ctx = ctx
|
||||
}
|
||||
|
||||
// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
|
||||
// particularly useful when testing.
|
||||
func (c *Command) SetArgs(a []string) {
|
||||
|
|
Loading…
Add table
Reference in a new issue