Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions config/config.go

This file was deleted.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.25.6

require (
github.com/charmbracelet/fang v0.4.4
github.com/duneanalytics/duneapi-client-go v0.4.0
github.com/spf13/cobra v1.10.2
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsV
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/duneanalytics/duneapi-client-go v0.4.0 h1:uK3cCIjhuMl3mGEfNivzj7AoA2H4T6QSgSnIIO4IlWI=
github.com/duneanalytics/duneapi-client-go v0.4.0/go.mod h1:7pXXufWvR/Mh2KOehdyBaunJXmHI+pzjUmyQTQhJjdE=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=
Expand Down
14 changes: 8 additions & 6 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (

"github.com/charmbracelet/fang"
"github.com/duneanalytics/cli/cmd/query"
"github.com/duneanalytics/cli/config"
"github.com/duneanalytics/duneapi-client-go/config"
"github.com/duneanalytics/duneapi-client-go/dune"
"github.com/spf13/cobra"
)

type envKey struct{}
type clientKey struct{}

var apiKeyFlag string

Expand All @@ -34,7 +35,8 @@ var rootCmd = &cobra.Command{
}
}

cmd.SetContext(context.WithValue(cmd.Context(), envKey{}, env))
client := dune.NewDuneClient(env)
cmd.SetContext(context.WithValue(cmd.Context(), clientKey{}, dune.DuneClient(client)))
return nil
},
}
Expand All @@ -44,9 +46,9 @@ func init() {
rootCmd.AddCommand(query.NewQueryCmd())
}

// EnvFromCmd extracts the *config.Env stored in the command's context.
func EnvFromCmd(cmd *cobra.Command) *config.Env {
return cmd.Context().Value(envKey{}).(*config.Env)
// ClientFromCmd extracts the DuneClient stored in the command's context.
func ClientFromCmd(cmd *cobra.Command) dune.DuneClient {
return cmd.Context().Value(clientKey{}).(dune.DuneClient)
}

// Execute runs the root command via Fang.
Expand Down
13 changes: 0 additions & 13 deletions models/error.go

This file was deleted.

Loading