Execute uses the args (os.Args[1:] by default) and run through the command tree finding appropriate matches for commands and then corresponding flags.
()
| 1068 | // and run through the command tree finding appropriate matches |
| 1069 | // for commands and then corresponding flags. |
| 1070 | func (c *Command) Execute() error { |
| 1071 | _, err := c.ExecuteC() |
| 1072 | return err |
| 1073 | } |
| 1074 | |
| 1075 | // ExecuteContextC is the same as ExecuteC(), but sets the ctx on the command. |
| 1076 | // Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs |