()
| 13 | ) |
| 14 | |
| 15 | func main() { |
| 16 | ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) |
| 17 | |
| 18 | if err := root.Execute(ctx, os.Stdin, os.Stdout, os.Stderr, os.Args[1:]...); err != nil { |
| 19 | cancel() |
| 20 | if statusErr, ok := errors.AsType[cli.StatusError](err); ok { |
| 21 | os.Exit(statusErr.StatusCode) |
| 22 | } |
| 23 | os.Exit(1) |
| 24 | } else { |
| 25 | cancel() |
| 26 | os.Exit(0) |
| 27 | } |
| 28 | } |