Skip to content

Commit

Permalink
gh: updates from v2.50.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed May 31, 2024
1 parent 0e8ed87 commit 54456e8
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
14 changes: 14 additions & 0 deletions completers/gh_completer/cmd/action/pullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ func ActionPullRequestFields() carapace.Action {
)
}

func ActionPullRequestCheckFields() carapace.Action {
return carapace.ActionValues(
"name",
"state",
"startedAt",
"completedAt",
"link",
"bucket",
"event",
"workflow",
"description",
)
}

func actionPullRequests(cmd *cobra.Command, id string, f func(p pullrequest) carapace.Action) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
repo, err := repoOverride(cmd, c)
Expand Down
7 changes: 7 additions & 0 deletions completers/gh_completer/cmd/pr_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ func init() {

pr_checksCmd.Flags().Bool("fail-fast", false, "Exit watch mode on first check failure")
pr_checksCmd.Flags().StringP("interval", "i", "", "Refresh interval in seconds when using `--watch` flag")
pr_checksCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`")
pr_checksCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`")
pr_checksCmd.Flags().Bool("required", false, "Only show checks that are required")
pr_checksCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"")
pr_checksCmd.Flags().Bool("watch", false, "Watch checks until they finish")
pr_checksCmd.Flags().BoolP("web", "w", false, "Open the web browser to show details about checks")
prCmd.AddCommand(pr_checksCmd)

carapace.Gen(pr_checksCmd).FlagCompletion(carapace.ActionMap{
"json": action.ActionPullRequestCheckFields().UniqueList(","),
})

carapace.Gen(pr_checksCmd).PositionalCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return carapace.Batch(
Expand Down
2 changes: 1 addition & 1 deletion completers/gh_completer/cmd/variable_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func init() {
variableCmd.AddCommand(variable_deleteCmd)

carapace.Gen(variable_deleteCmd).FlagCompletion(carapace.ActionMap{
"env": action.ActionEnvironments(variable_listCmd),
"env": action.ActionEnvironments(variable_deleteCmd),
"org": gh.ActionOrganizations(gh.HostOpts{}),
})

Expand Down
31 changes: 31 additions & 0 deletions completers/gh_completer/cmd/variable_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/gh_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/gh"
"github.com/spf13/cobra"
)

var variable_getCmd = &cobra.Command{
Use: "get <variable-name>",
Short: "Get variables",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(variable_getCmd).Standalone()

variable_getCmd.Flags().StringP("env", "e", "", "Get a variable for an environment")
variable_getCmd.Flags().StringP("org", "o", "", "Get a variable for an organization")
variableCmd.AddCommand(variable_getCmd)

carapace.Gen(variable_setCmd).FlagCompletion(carapace.ActionMap{
"env": action.ActionEnvironments(variable_setCmd),
"org": gh.ActionOrganizations(gh.HostOpts{}),
})

carapace.Gen(variable_getCmd).PositionalCompletion(
action.ActionVariables(variable_getCmd),
)
}
2 changes: 1 addition & 1 deletion completers/gh_completer/cmd/variable_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {
variableCmd.AddCommand(variable_setCmd)

carapace.Gen(variable_setCmd).FlagCompletion(carapace.ActionMap{
"env": action.ActionEnvironments(variable_listCmd),
"env": action.ActionEnvironments(variable_setCmd),
"env-file": carapace.ActionFiles(),
"org": gh.ActionOrganizations(gh.HostOpts{}),
"repos": gh.ActionOwnerRepositories(gh.HostOpts{}).UniqueList(","),
Expand Down

0 comments on commit 54456e8

Please sign in to comment.