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)
| 1060 | // Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs |
| 1061 | // functions. |
| 1062 | func (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 |