Skip to content

Commit

Permalink
Merge pull request #1877 from rsteube/gh-updates-2.35.0
Browse files Browse the repository at this point in the history
gh: updates from v2.35.0
  • Loading branch information
rsteube authored Sep 27, 2023
2 parents 79709c1 + 077aa74 commit 052252f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
12 changes: 9 additions & 3 deletions completers/gh_completer/cmd/alias_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@ import (
)

var alias_deleteCmd = &cobra.Command{
Use: "delete <alias>",
Short: "Delete an alias",
Use: "delete {<alias> | --all}",
Short: "Delete set aliases",
Run: func(cmd *cobra.Command, args []string) {},
}

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

alias_deleteCmd.Flags().Bool("all", false, "Delete all aliases")
aliasCmd.AddCommand(alias_deleteCmd)

carapace.Gen(alias_deleteCmd).PositionalCompletion(
action.ActionAliases(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if alias_deleteCmd.Flag("all").Changed {
return carapace.ActionValues()
}
return action.ActionAliases()
}),
)
}
5 changes: 5 additions & 0 deletions completers/gh_completer/cmd/cache_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/rsteube/carapace/pkg/style"
"github.com/spf13/cobra"
)
Expand All @@ -16,12 +17,16 @@ var cache_listCmd = &cobra.Command{
func init() {
carapace.Gen(cache_listCmd).Standalone()

cache_listCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`")
cache_listCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`")
cache_listCmd.Flags().StringP("limit", "L", "", "Maximum number of caches to fetch")
cache_listCmd.Flags().StringP("order", "O", "", "Order of caches returned: {asc|desc}")
cache_listCmd.Flags().StringP("sort", "S", "", "Sort fetched caches: {created_at|last_accessed_at|size_in_bytes}")
cache_listCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"")
cacheCmd.AddCommand(cache_listCmd)

carapace.Gen(cache_listCmd).FlagCompletion(carapace.ActionMap{
"json": gh.ActionCacheFields().UniqueList(","),
"order": carapace.ActionValues("asc", "desc").StyleF(style.ForKeyword),
"sort": carapace.ActionValues("created_at", "last_accessed_at", "size_in_bytes"),
})
Expand Down
2 changes: 2 additions & 0 deletions completers/gh_completer/cmd/release_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func init() {
release_createCmd.Flags().Bool("latest", false, "Mark this release as \"Latest\" (default: automatic based on date and version)")
release_createCmd.Flags().StringP("notes", "n", "", "Release notes")
release_createCmd.Flags().StringP("notes-file", "F", "", "Read release notes from `file` (use \"-\" to read from standard input)")
release_createCmd.Flags().Bool("notes-from-tag", false, "Automatically generate notes from annotated tag")
release_createCmd.Flags().String("notes-start-tag", "", "Tag to use as the starting point for generating release notes")
release_createCmd.Flags().BoolP("prerelease", "p", false, "Mark the release as a prerelease")
release_createCmd.Flags().String("target", "", "Target `branch` or full commit SHA (default: main branch)")
Expand All @@ -33,6 +34,7 @@ func init() {
carapace.Gen(release_createCmd).FlagCompletion(carapace.ActionMap{
"discussion-category": action.ActionDiscussionCategories(release_createCmd),
"notes-file": carapace.ActionFiles(),
"notes-from-tag": action.ActionReleases(release_createCmd),
"notes-start-tag": action.ActionReleases(release_createCmd),
"target": action.ActionBranches(release_createCmd),
})
Expand Down
16 changes: 16 additions & 0 deletions pkg/actions/tools/gh/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@ func ActionCaches(opts RepoOpts) carapace.Action {
})
}).Tag("caches")
}

// ActionCacheFields completes label fields
//
// id
// key
func ActionCacheFields() carapace.Action {
return carapace.ActionValues(
"createdAt",
"id",
"key",
"lastAccessedAt",
"ref",
"sizeInBytes",
"version",
)
}

0 comments on commit 052252f

Please sign in to comment.