Co-authored-by: kjuulh <contact@kjuulh.io>
Reviewed-on: https://git.front.kjuulh.io/kjuulh/kraken/pulls/8
This commit is contained in:
2022-09-18 16:49:34 +02:00
parent 15b627a717
commit 1f46f6ac8d
31 changed files with 1111 additions and 129 deletions

View File

@@ -9,17 +9,32 @@ import (
)
func CreateKrakenProcessCmd() *cobra.Command {
var (
actionsRepo string
branch string
path string
)
cmd := &cobra.Command{
Use: "process",
Run: func(cmd *cobra.Command, args []string) {
RunE: func(cmd *cobra.Command, args []string) error {
if err := cmd.ParseFlags(args); err != nil {
return err
}
client := http.Client{}
var buf bytes.Buffer
err := json.NewEncoder(&buf).
Encode(struct {
RepositoryUrls []string `json:"repositoryUrls"`
Repository string `json:"repository"`
Branch string `json:"branch"`
Path string `json:"path"`
}{
RepositoryUrls: []string{"git@git.front.kjuulh.io:kjuulh/kraken.git"}})
Repository: actionsRepo,
Branch: branch,
Path: path,
})
if err != nil {
panic(err)
}
@@ -41,8 +56,18 @@ func CreateKrakenProcessCmd() *cobra.Command {
if resp.StatusCode >= 300 {
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
}