with query results

This commit is contained in:
Kasper Juul Hermansen 2022-09-18 16:33:10 +02:00
parent f081d813a1
commit e760eb48ff
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 28 additions and 5 deletions

View File

@ -9,9 +9,19 @@ import (
) )
func CreateKrakenProcessCmd() *cobra.Command { func CreateKrakenProcessCmd() *cobra.Command {
var (
actionsRepo string
branch string
path string
)
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "process", Use: "process",
Run: func(cmd *cobra.Command, _ []string) { RunE: func(cmd *cobra.Command, args []string) error {
if err := cmd.ParseFlags(args); err != nil {
return err
}
client := http.Client{} client := http.Client{}
var buf bytes.Buffer var buf bytes.Buffer
@ -21,9 +31,9 @@ func CreateKrakenProcessCmd() *cobra.Command {
Branch string `json:"branch"` Branch string `json:"branch"`
Path string `json:"path"` Path string `json:"path"`
}{ }{
Repository: "git@git.front.kjuulh.io:kjuulh/kraken.git", Repository: actionsRepo,
Branch: "feature/query-results", Branch: branch,
Path: "_examples/queries/scrape_readme/", Path: path,
}) })
if err != nil { if err != nil {
panic(err) panic(err)
@ -46,8 +56,18 @@ func CreateKrakenProcessCmd() *cobra.Command {
if resp.StatusCode >= 300 { if resp.StatusCode >= 300 {
panic(resp.Status) panic(resp.Status)
} }
return nil
}, },
} }
pf := cmd.PersistentFlags()
pf.StringVar(&actionsRepo, "actions-repo", "", "actions repo is the location of your actions, not where to apply the actions themselves, that should be self contained")
cmd.MarkPersistentFlagRequired("actions-repo")
pf.StringVar(&branch, "branch", "main", "which branch to look for actions in, will default to main")
pf.StringVar(&path, "path", "", "the location of the path inside the repository")
cmd.MarkPersistentFlagRequired("path")
return cmd return cmd
} }

View File

@ -2,4 +2,7 @@
set -e set -e
go run cmd/kraken/kraken.go process current_branch=$(git branch --show-current)
go run cmd/kraken/kraken.go process --actions-repo "git@git.front.kjuulh.io:kjuulh/kraken.git" --branch "$current_branch" --path "_examples/actions/write_a_readme"
go run cmd/kraken/kraken.go process --actions-repo "git@git.front.kjuulh.io:kjuulh/kraken.git" --branch "$current_branch" --path "_examples/queries/scrape_readme"