(stdin io.Reader, stdout, stderr io.Writer)
| 30 | } |
| 31 | |
| 32 | func MustRun(stdin io.Reader, stdout, stderr io.Writer) { |
| 33 | ctx, err := Run(stdin, stdout, stderr) |
| 34 | if err == nil { |
| 35 | return |
| 36 | } |
| 37 | |
| 38 | if ctx == nil { |
| 39 | panic(err) |
| 40 | } |
| 41 | |
| 42 | ctx.Errorf("%s", err.Error()) |
| 43 | if errors.Is(err, ErrNoArgsGiven) { |
| 44 | if err := ctx.PrintUsage(false); err != nil { |
| 45 | panic(err) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | ctx.Exit(1) |
| 50 | } |
| 51 | |
| 52 | func Run(stdin io.Reader, stdout, stderr io.Writer) (*kong.Context, error) { |
| 53 | cli := &CLI{ |