Skip to content

Commit

Permalink
gh: updates from v2.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Nov 3, 2022
1 parent eda2aff commit a18549e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 deletions.
3 changes: 2 additions & 1 deletion completers/gh_completer/cmd/codespace_rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ var codespace_rebuildCmd = &cobra.Command{

func init() {
carapace.Gen(codespace_rebuildCmd).Standalone()
codespace_rebuildCmd.Flags().StringP("codespace", "c", "", "Name of the codespace")
codespace_rebuildCmd.Flags().StringP("codespace", "c", "", "name of the codespace")
codespace_rebuildCmd.Flags().Bool("full", false, "perform a full rebuild")
codespaceCmd.AddCommand(codespace_rebuildCmd)

carapace.Gen(codespace_rebuildCmd).FlagCompletion(carapace.ActionMap{
Expand Down
42 changes: 42 additions & 0 deletions completers/gh_completer/cmd/issue_develop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package cmd

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

var issue_developCmd = &cobra.Command{
Use: "develop",
Short: "Manage linked branches for an issue",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(issue_developCmd).Standalone()
issue_developCmd.Flags().StringP("base", "b", "", "Name of the base branch you want to make your new branch from")
issue_developCmd.Flags().BoolP("checkout", "c", false, "Checkout the branch after creating it")
issue_developCmd.Flags().StringP("issue-repo", "i", "", "Name or URL of the issue's repository")
issue_developCmd.Flags().BoolP("list", "l", false, "List linked branches for the issue")
issue_developCmd.Flags().StringP("name", "n", "", "Name of the branch to create")
issueCmd.AddCommand(issue_developCmd)

carapace.Gen(issue_developCmd).FlagCompletion(carapace.ActionMap{
"base": action.ActionBranches(issue_developCmd),
"issue-repo": gh.ActionOwnerRepositories(gh.HostOpts{}),
"name": action.ActionBranches(issue_developCmd),
})

carapace.Gen(issue_developCmd).PositionalCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if flag := issue_developCmd.Flag("issue-repo"); flag.Changed {
cmd := &cobra.Command{}
cmd.Flags().String("repo", flag.Value.String(), "fake-repo")
cmd.Flag("repo").Changed = true
return action.ActionIssues(cmd, action.IssueOpts{Open: true})
}
return action.ActionIssues(issue_developCmd, action.IssueOpts{Open: true})
}),
)
}
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/release_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
release_createCmd.Flags().String("discussion-category", "", "Start a discussion in the specified category")
release_createCmd.Flags().BoolP("draft", "d", false, "Save the release as a draft instead of publishing it")
release_createCmd.Flags().Bool("generate-notes", false, "Automatically generate title and notes for the release")
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().String("notes-start-tag", "", "Tag to use as the starting point for generating release notes")
Expand Down
7 changes: 6 additions & 1 deletion completers/gh_completer/cmd/release_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ func init() {
carapace.Gen(release_downloadCmd).Standalone()
release_downloadCmd.Flags().StringP("archive", "A", "", "Download the source code archive in the specified `format` (zip or tar.gz)")
release_downloadCmd.Flags().Bool("clobber", false, "Overwrite existing files of the same name")
release_downloadCmd.Flags().StringP("dir", "D", ".", "The directory to download files into")
release_downloadCmd.Flags().StringP("dir", "D", ".", "The `directory` to download files into")
release_downloadCmd.Flags().StringP("output", "O", "", "The `file` to write a single asset to (use \"-\" to write to standard output)")
release_downloadCmd.Flags().StringArrayP("pattern", "p", []string{}, "Download only assets that match a glob pattern")
release_downloadCmd.Flags().Bool("skip-existing", false, "Skip downloading when files of the same name exist")
releaseCmd.AddCommand(release_downloadCmd)

carapace.Gen(release_downloadCmd).FlagCompletion(carapace.ActionMap{
"archive": carapace.ActionValues("zip", "tar.gz"),
"dir": carapace.ActionDirectories(),
"output": carapace.Batch(
carapace.ActionValuesDescribed("-", "standard output"),
carapace.ActionFiles(),
).ToA(),
"pattern": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if len(c.Args) > 0 {
return action.ActionReleaseAssets(release_downloadCmd, c.Args[0])
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/release_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func init() {
carapace.Gen(release_editCmd).Standalone()
release_editCmd.Flags().String("discussion-category", "", "Start a discussion in the specified category when publishing a draft")
release_editCmd.Flags().Bool("draft", false, "Save the release as a draft instead of publishing it")
release_editCmd.Flags().Bool("latest", false, "Explicitly mark the release as \"Latest\"")
release_editCmd.Flags().StringP("notes", "n", "", "Release notes")
release_editCmd.Flags().StringP("notes-file", "F", "", "Read release notes from `file` (use \"-\" to read from standard input)")
release_editCmd.Flags().Bool("prerelease", false, "Mark the release as a prerelease")
Expand Down
8 changes: 4 additions & 4 deletions completers/gh_completer/cmd/repo_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func init() {
repo_listCmd.Flags().Bool("no-archived", false, "Omit archived repositories")
repo_listCmd.Flags().Bool("source", false, "Show only non-forks")
repo_listCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"")
repo_listCmd.Flags().String("topic", "", "Filter by topic")
repo_listCmd.Flags().StringSlice("topic", []string{}, "Filter by topic")
repo_listCmd.Flags().String("visibility", "", "Filter by repository visibility: {public|private|internal}")
repoCmd.AddCommand(repo_listCmd)

Expand All @@ -34,11 +34,11 @@ func init() {
return action.ActionRepositoryFields().Invoke(c).Filter(c.Parts).ToA()
}),
"language": action.ActionLanguages(),
"topic": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
"topic": carapace.ActionMultiParts(",", func(c carapace.Context) carapace.Action {
if len(c.Args) > 0 {
return action.ActionTopics(repo_listCmd, c.Args[0])
return action.ActionTopics(repo_listCmd, c.Args[0]).Invoke(c).Filter(c.Parts).ToA()
}
return action.ActionTopics(repo_listCmd, "")
return action.ActionTopics(repo_listCmd, "").Invoke(c).Filter(c.Parts).ToA()
}),
"visibility": carapace.ActionValues("public", "private", "internal"),
})
Expand Down

0 comments on commit a18549e

Please sign in to comment.