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

Function Run

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

Source from the content-addressed store, hash-verified

50}
51
52func Run(stdin io.Reader, stdout, stderr io.Writer) (*kong.Context, error) {
53 cli := &CLI{
54 Globals: Globals{
55 Stdin: stdin,
56 Stdout: stdout,
57 Stderr: stderr,
58 helpPrinter: kong.DefaultHelpPrinter,
59 },
60 }
61
62 ctx := kong.Parse(
63 cli,
64 kong.Name("dasel"),
65 kong.Description("Query and modify data structures from the command line."),
66 kong.UsageOnError(),
67 kong.ConfigureHelp(kong.HelpOptions{Compact: true}),
68 kong.Vars{
69 "version": internal.Version,
70 },
71 kong.Bind(&cli.Globals),
72 kong.TypeMapper(reflect.TypeFor[variables](), &variableMapper{}),
73 kong.TypeMapper(reflect.TypeFor[extReadWriteFlags](), &extReadWriteFlagMapper{}),
74 kong.OptionFunc(func(k *kong.Kong) error {
75 k.Stdout = cli.Stdout
76 k.Stderr = cli.Stderr
77 return nil
78 }),
79 kong.Help(cli.helpPrinter),
80 )
81 cli.Kong = ctx.Kong
82 err := ctx.Run()
83 return ctx, err
84}

Callers 3

runDaselCmdFunction · 0.92
runDaselFunction · 0.92
MustRunFunction · 0.85

Calls 2

ParseMethod · 0.80
RunMethod · 0.45

Tested by 2

runDaselCmdFunction · 0.74
runDaselFunction · 0.74