| 1 | package cliscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/ |
| 2 | |
| 3 | import "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 4 | |
| 5 | type QueryCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd# struct { |
| 6 | Varsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Vars. variablesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/variables# `flag:"" name:"var" help:"Variables to pass to the query. E.g. --var foo=\"bar\" --var baz=json:file:./some/file.json"` |
| 7 | ExtReadWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ExtReadWriteFlags. extReadWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/extReadWriteFlags# `flag:"" name:"rw-flag" help:"Read/Write flag to customise parsing/output. Applies to read + write E.g. --rw-flag csv-delimiter=;"` |
| 8 | ExtReadFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ExtReadFlags. extReadWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/extReadWriteFlags# `flag:"" name:"read-flag" help:"Reader flag to customise parsing. E.g. --read-flag xml-mode=structured"` |
| 9 | ExtWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ExtWriteFlags. extReadWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/extReadWriteFlags# `flag:"" name:"write-flag" help:"Writer flag to customise output. E.g. --write-flag csv-delimiter=;"` |
| 10 | InFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#InFormat. string `flag:"" name:"in" short:"i" help:"The format of the input data."` |
| 11 | OutFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#OutFormat. string `flag:"" name:"out" short:"o" help:"The format of the output data."` |
| 12 | ReturnRootscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ReturnRoot. bool `flag:"" name:"root" help:"Return the root value."` |
| 13 | Compactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Compact. bool `flag:"" name:"compact" help:"Output in compact mode (no indentation/newlines)."` |
| 14 | Unstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Unstable. bool `flag:"" name:"unstable" help:"Allow access to potentially unstable features."` |
| 15 | Interactivescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Interactive. bool `flag:"" name:"it" help:"Run in interactive mode (alpha)."` |
| 16 | |
| 17 | ConfigPathscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ConfigPath. string `name:"config" short:"c" help:"Path to config file" default:"~/dasel.yaml"` |
| 18 | |
| 19 | Queryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Query. string `arg:"" help:"The query to execute." optional:"" default:""` |
| 20 | } |
| 21 | |
| 22 | func (c *QueryCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#) Runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Run().(ctx *Globalsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#) error { |
| 23 | cfg, err := LoadConfigscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/LoadConfig().(c.ConfigPathscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ConfigPath.) |
| 24 | if err != nil { |
| 25 | return err |
| 26 | } |
| 27 | |
| 28 | if c.InFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#InFormat. == "" && c.OutFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#OutFormat. == "" { |
| 29 | c.InFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#InFormat. = cfg.DefaultFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Config#DefaultFormat. |
| 30 | c.OutFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#OutFormat. = cfg.DefaultFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Config#DefaultFormat. |
| 31 | } |
| 32 | |
| 33 | if c.Queryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Query. == "" && c.InFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#InFormat. == "" && ctx.Stdinscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdin. == nil { |
| 34 | return ErrNoArgsGivenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/ErrNoArgsGiven. |
| 35 | } |
| 36 | |
| 37 | if c.Interactivescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Interactive. { |
| 38 | return NewInteractiveCmdscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/NewInteractiveCmd().(c).Runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/InteractiveCmd#Run().(ctx) |
| 39 | } |
| 40 | |
| 41 | o := runOptsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#{ |
| 42 | Varsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#Vars.: c.Varsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Vars., |
| 43 | ExtReadWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#ExtReadWriteFlags.: c.ExtReadWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ExtReadWriteFlags., |
| 44 | ExtReadFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#ExtReadFlags.: c.ExtReadFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ExtReadFlags., |
| 45 | ExtWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#ExtWriteFlags.: c.ExtWriteFlagsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ExtWriteFlags., |
| 46 | InFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#InFormat.: c.InFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#InFormat., |
| 47 | OutFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#OutFormat.: c.OutFormatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#OutFormat., |
| 48 | Compactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#Compact.: c.Compactscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Compact., |
| 49 | ReturnRootscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#ReturnRoot.: c.ReturnRootscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ReturnRoot., |
| 50 | Unstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#Unstable.: c.Unstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Unstable., |
| 51 | Queryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#Query.: c.Queryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#Query., |
| 52 | |
| 53 | ConfigPathscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#ConfigPath.: c.ConfigPathscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/QueryCmd#ConfigPath., |
| 54 | |
| 55 | Stdinscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/runOpts#Stdin.: ctx.Stdinscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdin., |
| 56 | } |
| 57 | outBytes, err := runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/run().(o) |
| 58 | if err != nil { |
| 59 | return err |
| 60 | } |
| 61 | |
| 62 | _, err = ctx.Stdoutscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/internal/cli`/Globals#Stdout..Writescip-go gomod github.com/golang/go/src go1.25 io/Writer#Write().(outBytes) |
| 63 | if err != nil { |
| 64 | return fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("error writing output: %w", err) |
| 65 | } |
| 66 | |
| 67 | return nil |
| 68 | } |