MCPcopy
hub / github.com/TomWright/dasel / MustRun

Function MustRun

internal/cli/command.go:32–50  ·  view source on GitHub ↗
(stdin io.Reader, stdout, stderr io.Writer)

Source from the content-addressed store, hash-verified

30}
31
32func 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
52func Run(stdin io.Reader, stdout, stderr io.Writer) (*kong.Context, error) {
53 cli := &CLI{

Callers 1

mainFunction · 0.92

Calls 2

RunFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected