v0.1 (#8)
Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: https://git.front.kjuulh.io/kjuulh/kraken/pulls/8
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user