Skip to content

Commit

Permalink
Merge pull request #75 from wesen/task/add-command-handler
Browse files Browse the repository at this point in the history
✨ Add command handler, bump glazed
  • Loading branch information
wesen authored Aug 8, 2023
2 parents 5b8a2ff + fd45e91 commit 6774a75
Show file tree
Hide file tree
Showing 11 changed files with 640 additions and 311 deletions.
8 changes: 2 additions & 6 deletions cmd/parka/cmds/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

type ExampleCommand struct {
description *cmds.CommandDescription
*cmds.CommandDescription
}

func NewExampleCommand() *ExampleCommand {
Expand Down Expand Up @@ -110,7 +110,7 @@ func NewExampleCommand() *ExampleCommand {
},
}
return &ExampleCommand{
description: description,
CommandDescription: description,
}
}

Expand Down Expand Up @@ -154,10 +154,6 @@ func (e *ExampleCommand) Run(
return nil
}

func (e *ExampleCommand) Description() *cmds.CommandDescription {
return e.description
}

func (e *ExampleCommand) RunFromParka(
c *gin.Context,
parsedLayers map[string]*layers.ParsedParameterLayer,
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/alecthomas/chroma/v2 v2.2.0
github.com/gin-gonic/contrib v0.0.0-20221130124618-7e01895a63f2
github.com/gin-gonic/gin v1.9.0
github.com/go-go-golems/clay v0.0.18
github.com/go-go-golems/glazed v0.3.6
github.com/go-go-golems/clay v0.0.20
github.com/go-go-golems/glazed v0.4.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.29.0
github.com/spf13/cobra v1.6.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH8
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-go-golems/clay v0.0.18 h1:smhX//d2xuinPWAx+MOlZxMva2bTQDg5Kl+dN1b3YVc=
github.com/go-go-golems/clay v0.0.18/go.mod h1:lwCix3m4IQDIbXnb5F6uVayADuKVHNKPngJdxCTEelU=
github.com/go-go-golems/glazed v0.3.6 h1:4td0er4bsQh8QanUe4FCDBEXnuXIbu3mwnpgmNi8VdQ=
github.com/go-go-golems/glazed v0.3.6/go.mod h1:nv4FnbQ7kgWQlzyxA3+10jmEc/GDsw3SB0A/sWH14FQ=
github.com/go-go-golems/clay v0.0.20 h1:GRFIL1g355zWjjofmPvhPreE3AsZ8tXncu9cG2GPZMw=
github.com/go-go-golems/clay v0.0.20/go.mod h1:N9idImzYUpWLZ7eMVAymHYt0cbYO2E99MqejejZOP8A=
github.com/go-go-golems/glazed v0.4.0 h1:c03NZmzmYcaG4zdzfWMuyHW8cTNZUA+l292Lzyvt174=
github.com/go-go-golems/glazed v0.4.0/go.mod h1:HcUz88LiTEPK8cWD5pWup0rjwzIDH4loaZnMVuT4Qfc=
github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc=
github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk=
github.com/go-openapi/strfmt v0.21.7 h1:rspiXgNWgeUzhjo1YU01do6qsahtJNByjLVbPLNHb8k=
Expand Down
10 changes: 0 additions & 10 deletions pkg/glazed/handlers/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ func (h *QueryHandler) Handle(c *gin.Context, writer io.Writer) error {

c.Header("Content-Type", "application/json")

_, err = writer.Write([]byte("[\n"))
if err != nil {
return err
}

ctx := c.Request.Context()
err = h.cmd.Run(ctx, pc.ParsedLayers, pc.ParsedParameters, gp)
if err != nil {
Expand All @@ -91,11 +86,6 @@ func (h *QueryHandler) Handle(c *gin.Context, writer io.Writer) error {
return err
}

_, err = writer.Write([]byte("\n]"))
if err != nil {
return err
}

return nil
}

Expand Down
Loading

0 comments on commit 6774a75

Please sign in to comment.