Debian Codegraph @

internal/cli/command.go

raw symbols SCIP
1 package cliscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/
2
3 import (
4 "errorsscip-go gomod github.com/golang/go/src go1.25 errors/"
5 "ioscip-go gomod github.com/golang/go/src go1.25 io/"
6 "reflectscip-go gomod github.com/golang/go/src go1.25 reflect/"
7
8 "github.com/alecthomas/kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/"
9 "github.com/tomwright/dasel/v3/internalscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal`/"
10 )
11
12 var ErrNoArgsGivenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/ErrNoArgsGiven. = errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Newscip-go gomod github.com/golang/go/src go1.25 errors/New().("no arguments given")
13
14 type Globalsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals# struct {
15 Stdinscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdin. ioscip-go gomod github.com/golang/go/src go1.25 io/.Readerscip-go gomod github.com/golang/go/src go1.25 io/Reader# `kong:"-"`
16 Stdoutscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdout. ioscip-go gomod github.com/golang/go/src go1.25 io/.Writerscip-go gomod github.com/golang/go/src go1.25 io/Writer# `kong:"-"`
17 Stderrscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stderr. ioscip-go gomod github.com/golang/go/src go1.25 io/.Writerscip-go gomod github.com/golang/go/src go1.25 io/Writer# `kong:"-"`
18 Kongscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Kong. *kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Kong# `kong:"-"`
19 helpPrinterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#helpPrinter. kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.HelpPrinterscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/HelpPrinter# `kong:"-"`
20 }
21
22 type CLIscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI# struct {
23 Globalsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Globals.
24
25 Queryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Query. QueryCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd# `cmd:"" default:"withargs" help:"[default] Execute a query"`
26 Versionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Version. VersionCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/VersionCmd# `cmd:"" help:"Print the version"`
27 Interactivescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Interactive. InteractiveCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/InteractiveCmd# `cmd:"" help:"Start an interactive session (alpha)"`
28 Completionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Completion. CompletionCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CompletionCmd# `cmd:"" help:"Generate shell completion script"`
29 Manscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Man. ManCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/ManCmd# `cmd:"" help:"Generate man page"`
30 }
31
32 func MustRunscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/MustRun().(stdin ioscip-go gomod github.com/golang/go/src go1.25 io/.Readerscip-go gomod github.com/golang/go/src go1.25 io/Reader#, stdout, stderr ioscip-go gomod github.com/golang/go/src go1.25 io/.Writerscip-go gomod github.com/golang/go/src go1.25 io/Writer#) {
33 ctx, err := Runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Run().(stdin, stdout, stderr)
34 if err == nil {
35 return
36 }
37
38 if ctx == nil {
39 panic(err)
40 }
41
42 ctx.Errorfscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Kong#Errorf().("%s", err.Error())
43 if errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Isscip-go gomod github.com/golang/go/src go1.25 errors/Is().(err, ErrNoArgsGivenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/ErrNoArgsGiven.) {
44 if err := ctx.PrintUsagescip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Context#PrintUsage().(false); err != nil {
45 panic(err)
46 }
47 }
48
49 ctx.Exitscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Kong#Exit.(1)
50 }
51
52 func Runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Run().(stdin ioscip-go gomod github.com/golang/go/src go1.25 io/.Readerscip-go gomod github.com/golang/go/src go1.25 io/Reader#, stdout, stderr ioscip-go gomod github.com/golang/go/src go1.25 io/.Writerscip-go gomod github.com/golang/go/src go1.25 io/Writer#) (*kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Contextscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Context#, error) {
53 cli := &CLIscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#{
54 Globalsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Globals.: Globalsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#{
55 Stdinscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdin.: stdin,
56 Stdoutscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdout.: stdout,
57 Stderrscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stderr.: stderr,
58 helpPrinterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#helpPrinter.: kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.DefaultHelpPrinterscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/DefaultHelpPrinter().,
59 },
60 }
61
62 ctx := kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Parsescip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Parse().(
63 cli,
64 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Namescip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Name().("dasel"),
65 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Descriptionscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Description().("Query and modify data structures from the command line."),
66 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.UsageOnErrorscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/UsageOnError().(),
67 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.ConfigureHelpscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/ConfigureHelp().(kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.HelpOptionsscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/HelpOptions#{Compactscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/HelpOptions#Compact.: true}),
68 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Varsscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Vars#{
69 "version": internalscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal`/.Versionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal`/Version.,
70 },
71 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Bindscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Bind().(&cli.Globalsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/CLI#Globals.),
72 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.TypeMapperscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/TypeMapper().(reflectscip-go gomod github.com/golang/go/src go1.25 reflect/.TypeForscip-go gomod github.com/golang/go/src go1.25 reflect/TypeFor().[variablesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/variables#](), &variableMapperscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/variableMapper#{}),
73 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.TypeMapperscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/TypeMapper().(reflectscip-go gomod github.com/golang/go/src go1.25 reflect/.TypeForscip-go gomod github.com/golang/go/src go1.25 reflect/TypeFor().[extReadWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/extReadWriteFlags#](), &extReadWriteFlagMapperscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/extReadWriteFlagMapper#{}),
74 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.OptionFuncscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/OptionFunc#(func(k *kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Kong#) error {
75 k.Stdoutscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Kong#Stdout. = cli.Stdoutscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdout.
76 k.Stderrscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Kong#Stderr. = cli.Stderrscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stderr.
77 return nil
78 }),
79 kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/.Helpscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Help().(cli.helpPrinterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#helpPrinter.),
80 )
81 cli.Kongscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Kong. = ctx.Kongscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Context#Kong.
82 err := ctx.Runscip-go gomod github.com/alecthomas/kong v1.14.0 `github.com/alecthomas/kong`/Context#Run().()
83 return ctx, err
84 }