Skip to content

Commit

Permalink
Merge pull request #2214 from rsteube/gh-updates-v2.43.0
Browse files Browse the repository at this point in the history
gh: updates from v2.43.0
  • Loading branch information
rsteube authored Jan 31, 2024
2 parents ba01241 + eec1a44 commit 7e9709b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/auth_setupGit.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var auth_setupGitCmd = &cobra.Command{
func init() {
carapace.Gen(auth_setupGitCmd).Standalone()

auth_setupGitCmd.Flags().BoolP("force", "f", false, "Force setup even if the host is not known. Must be used in conjunction with `--hostname`")
auth_setupGitCmd.Flags().StringP("hostname", "h", "", "The hostname to configure git for")
authCmd.AddCommand(auth_setupGitCmd)

Expand Down
8 changes: 8 additions & 0 deletions completers/gh_completer/cmd/release_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/tools/gh"
"github.com/spf13/cobra"
)

Expand All @@ -18,6 +19,13 @@ func init() {

release_listCmd.Flags().Bool("exclude-drafts", false, "Exclude draft releases")
release_listCmd.Flags().Bool("exclude-pre-releases", false, "Exclude pre-releases")
release_listCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`")
release_listCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`")
release_listCmd.Flags().StringP("limit", "L", "", "Maximum number of items to fetch")
release_listCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"")
releaseCmd.AddCommand(release_listCmd)

carapace.Gen(release_listCmd).FlagCompletion(carapace.ActionMap{
"json": gh.ActionReleaseFields().UniqueList(","),
})
}
8 changes: 6 additions & 2 deletions completers/gh_completer/cmd/variable_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ func init() {
carapace.Gen(variable_listCmd).Standalone()

variable_listCmd.Flags().StringP("env", "e", "", "List variables for an environment")
variable_listCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`")
variable_listCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`")
variable_listCmd.Flags().StringP("org", "o", "", "List variables for an organization")
variable_listCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"")
variableCmd.AddCommand(variable_listCmd)

carapace.Gen(variable_listCmd).FlagCompletion(carapace.ActionMap{
"env": action.ActionEnvironments(variable_listCmd),
"org": gh.ActionOrganizations(gh.HostOpts{}),
"env": action.ActionEnvironments(variable_listCmd),
"json": gh.ActionVariableFields().UniqueList(","),
"org": gh.ActionOrganizations(gh.HostOpts{}),
})
}
19 changes: 19 additions & 0 deletions pkg/actions/tools/gh/release.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package gh

import "github.com/rsteube/carapace"

// ActionReleaseFields completes release fields
//
// name
// tagName
func ActionReleaseFields() carapace.Action {
return carapace.ActionValues(
"name",
"tagName",
"isDraft",
"isLatest",
"isPrerelease",
"createdAt",
"publishedAt",
)
}
15 changes: 15 additions & 0 deletions pkg/actions/tools/gh/variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,18 @@ func ActionOrganisationVariables(opts OwnerOpts) carapace.Action {
})
})
}

// ActionVariableFields completes variable fields
//
// name
// value
func ActionVariableFields() carapace.Action {
return carapace.ActionValues(
"name",
"value",
"visibility",
"updatedAt",
"numSelectedRepos",
"selectedReposURL",
)
}

0 comments on commit 7e9709b

Please sign in to comment.