Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
(ctx context.Context)
| 39 | // Execute adds all child commands to the root command and sets flags appropriately. |
| 40 | // This is called by main.main(). It only needs to happen once to the rootCmd. |
| 41 | func Execute(ctx context.Context) { |
| 42 | if err := rootCmd.ExecuteContext(ctx); err != nil { |
| 43 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) |
| 44 | os.Exit(1) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | func init() { |
| 49 | cobra.OnInitialize(initConfig) |