Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh: updates from v2.50.0 #2393

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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