Execute is the entry point called from main. Exit code convention: 0 — success / guardrail passed 1 — runtime error (build, auth, network, bad input) 2 — a cost guardrail threshold was breached
()
| 28 | // 1 — runtime error (build, auth, network, bad input) |
| 29 | // 2 — a cost guardrail threshold was breached |
| 30 | func Execute() { |
| 31 | if err := rootCmd.Execute(); err != nil { |
| 32 | fmt.Fprintln(os.Stderr, err) |
| 33 | var breach *guardrailBreachError |
| 34 | if errors.As(err, &breach) { |
| 35 | os.Exit(2) |
| 36 | } |
| 37 | os.Exit(1) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | func init() { |
| 42 | rootCmd.AddCommand( |