Skip to content

Commit

Permalink
Merge pull request #784 from rsteube/gh-2.3.0-updates
Browse files Browse the repository at this point in the history
gh: updates from 2.3.0
  • Loading branch information
rsteube authored Dec 2, 2021
2 parents 4f96433 + ffdf116 commit be6cb37
Show file tree
Hide file tree
Showing 111 changed files with 366 additions and 130 deletions.
4 changes: 3 additions & 1 deletion completers/gh_completer/cmd/actions.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var actionsCmd = &cobra.Command{
Use: "actions",
Short: "Learn about working with GitHub actions",
Short: "Learn about working with GitHub Actions",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(actionsCmd).Standalone()
rootCmd.AddCommand(actionsCmd)
}
5 changes: 4 additions & 1 deletion completers/gh_completer/cmd/alias.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var aliasCmd = &cobra.Command{
Use: "alias <command>",
Use: "alias",
Short: "Create command shortcuts",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(aliasCmd).Standalone()
rootCmd.AddCommand(aliasCmd)
}
3 changes: 2 additions & 1 deletion completers/gh_completer/cmd/alias_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
)

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

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

carapace.Gen(alias_deleteCmd).PositionalCompletion(
Expand Down
2 changes: 2 additions & 0 deletions completers/gh_completer/cmd/alias_list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

Expand All @@ -11,5 +12,6 @@ var alias_listCmd = &cobra.Command{
}

func init() {
carapace.Gen(alias_listCmd).Standalone()
aliasCmd.AddCommand(alias_listCmd)
}
4 changes: 3 additions & 1 deletion completers/gh_completer/cmd/alias_set.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var alias_setCmd = &cobra.Command{
Use: "set <alias> <expansion>",
Use: "set",
Short: "Create a shortcut for a gh command",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(alias_setCmd).Standalone()
alias_setCmd.Flags().BoolP("shell", "s", false, "Declare an alias to be passed through a shell interpreter")
aliasCmd.AddCommand(alias_setCmd)
}
5 changes: 3 additions & 2 deletions completers/gh_completer/cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import (
)

var apiCmd = &cobra.Command{
Use: "api <endpoint>",
Use: "api",
Short: "Make an authenticated GitHub API request",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(apiCmd).Standalone()
apiCmd.Flags().Duration("cache", 0, "Cache the response, e.g. \"3600s\", \"60m\", \"1h\"")
apiCmd.Flags().StringArrayP("field", "F", nil, "Add a typed parameter in `key=value` format")
apiCmd.Flags().StringArrayP("header", "H", nil, "Add a HTTP request header in `key:value` format")
apiCmd.Flags().String("hostname", "", "The GitHub hostname for the request (default \"github.com\")")
Expand All @@ -25,7 +27,6 @@ func init() {
apiCmd.Flags().StringArrayP("raw-field", "f", nil, "Add a string parameter in `key=value` format")
apiCmd.Flags().Bool("silent", false, "Do not print the response body")
apiCmd.Flags().StringP("template", "t", "", "Format the response using a Go template")
apiCmd.Flags().Duration("cache", 0, "Cache the response, e.g. \"3600s\", \"60m\", \"1h\"")
rootCmd.AddCommand(apiCmd)

carapace.Gen(apiCmd).FlagCompletion(carapace.ActionMap{
Expand Down
4 changes: 3 additions & 1 deletion completers/gh_completer/cmd/auth.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var authCmd = &cobra.Command{
Use: "auth <command>",
Use: "auth",
Short: "Login, logout, and refresh your authentication",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(authCmd).Standalone()
rootCmd.AddCommand(authCmd)
}
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/auth_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var auth_loginCmd = &cobra.Command{
}

func init() {
carapace.Gen(auth_loginCmd).Standalone()
auth_loginCmd.Flags().StringP("hostname", "h", "", "The hostname of the GitHub instance to authenticate with")
auth_loginCmd.Flags().StringSliceP("scopes", "s", nil, "Additional authentication scopes for gh to have")
auth_loginCmd.Flags().BoolP("web", "w", false, "Open a browser to authenticate")
Expand Down
2 changes: 2 additions & 0 deletions completers/gh_completer/cmd/auth_logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import (
var auth_logoutCmd = &cobra.Command{
Use: "logout",
Short: "Log out of a GitHub host",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(auth_logoutCmd).Standalone()
auth_logoutCmd.Flags().StringP("hostname", "h", "", "The hostname of the GitHub instance to log out of")
authCmd.AddCommand(auth_logoutCmd)

Expand Down
2 changes: 2 additions & 0 deletions completers/gh_completer/cmd/auth_refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import (
var auth_refreshCmd = &cobra.Command{
Use: "refresh",
Short: "Refresh stored authentication credentials",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(auth_refreshCmd).Standalone()
auth_refreshCmd.Flags().StringP("hostname", "h", "", "The GitHub host to use for authentication")
auth_refreshCmd.Flags().StringSliceP("scopes", "s", nil, "Additional authentication scopes for gh to have")
authCmd.AddCommand(auth_refreshCmd)
Expand Down
23 changes: 23 additions & 0 deletions completers/gh_completer/cmd/auth_setupGit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

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

var auth_setupGitCmd = &cobra.Command{
Use: "setup-git",
Short: "Configure git to use GitHub CLI as a credential helper",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(auth_setupGitCmd).Standalone()
auth_setupGitCmd.Flags().StringP("hostname", "h", "", "The hostname to configure git for")
authCmd.AddCommand(auth_setupGitCmd)

carapace.Gen(auth_setupGitCmd).FlagCompletion(carapace.ActionMap{
"hostname": action.ActionConfigHosts(),
})
}
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/auth_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var auth_statusCmd = &cobra.Command{
}

func init() {
carapace.Gen(auth_statusCmd).Standalone()
auth_statusCmd.Flags().StringP("hostname", "h", "", "Check a specific hostname's auth status")
auth_statusCmd.Flags().BoolP("show-token", "t", false, "Display the auth token")
authCmd.AddCommand(auth_statusCmd)
Expand Down
3 changes: 2 additions & 1 deletion completers/gh_completer/cmd/browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import (
)

var browseCmd = &cobra.Command{
Use: "browse [<number> | <path>]",
Use: "browse",
Short: "Open the repository in the browser",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(browseCmd).Standalone()
browseCmd.Flags().StringP("branch", "b", "", "Select another branch by passing in the branch name")
browseCmd.Flags().BoolP("commit", "c", false, "Open the last commit")
browseCmd.Flags().BoolP("no-browser", "n", false, "Print destination URL instead of opening the browser")
Expand Down
2 changes: 2 additions & 0 deletions completers/gh_completer/cmd/codespace.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

Expand All @@ -11,5 +12,6 @@ var codespaceCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespaceCmd).Standalone()
rootCmd.AddCommand(codespaceCmd)
}
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_codeCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_codeCmd).Standalone()
codespace_codeCmd.Flags().StringP("codespace", "c", "", "Name of the codespace")
codespace_codeCmd.Flags().Bool("insiders", false, "Use the insiders version of Visual Studio Code")
codespaceCmd.AddCommand(codespace_codeCmd)
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var codespace_cpCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_cpCmd).Standalone()
codespace_cpCmd.Flags().StringP("codespace", "c", "", "Name of the codespace")
codespace_cpCmd.Flags().BoolP("expand", "e", false, "Expand remote file names on remote shell")
codespace_cpCmd.Flags().BoolP("recursive", "r", false, "Recursively copy directories")
Expand Down
2 changes: 2 additions & 0 deletions completers/gh_completer/cmd/codespace_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ var codespace_createCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_createCmd).Standalone()
codespace_createCmd.Flags().StringP("branch", "b", "", "repository branch")
codespace_createCmd.Flags().Duration("idle-timeout", 0, "allowed inactivity before codespace is stopped, e.g. \"10m\", \"1h\"")
codespace_createCmd.Flags().StringP("machine", "m", "", "hardware specifications for the VM")
codespace_createCmd.Flags().StringP("repo", "r", "", "repository name with owner: user/repo")
codespace_createCmd.Flags().BoolP("status", "s", false, "show status of post-create command and dotfiles")
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_deleteCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_deleteCmd).Standalone()
codespace_deleteCmd.Flags().Bool("all", false, "Delete all codespaces")
codespace_deleteCmd.Flags().StringP("codespace", "c", "", "Name of the codespace")
codespace_deleteCmd.Flags().Uint16("days", 0, "Delete codespaces older than `N` days")
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_listCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_listCmd).Standalone()
codespace_listCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`")
codespace_listCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`")
codespace_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of codespaces to list")
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_logsCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_logsCmd).Standalone()
codespace_logsCmd.Flags().StringP("codespace", "c", "", "Name of the codespace")
codespace_logsCmd.Flags().BoolP("follow", "f", false, "Tail and follow the logs")
codespaceCmd.AddCommand(codespace_logsCmd)
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_portsCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_portsCmd).Standalone()
codespace_portsCmd.PersistentFlags().StringP("codespace", "c", "", "Name of the codespace")
codespace_portsCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`")
codespace_portsCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`")
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_ports_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var codespace_ports_forwardCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_ports_forwardCmd).Standalone()
codespace_portsCmd.AddCommand(codespace_ports_forwardCmd)

carapace.Gen(codespace_ports_forwardCmd).PositionalCompletion(
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_ports_visibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_ports_visibilityCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_ports_visibilityCmd).Standalone()
codespace_portsCmd.AddCommand(codespace_ports_visibilityCmd)

carapace.Gen(codespace_ports_visibilityCmd).PositionalAnyCompletion(
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_sshCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_sshCmd).Standalone()
codespace_sshCmd.Flags().StringP("codespace", "c", "", "Name of the codespace")
codespace_sshCmd.Flags().BoolP("debug", "d", false, "Log debug data to a file")
codespace_sshCmd.Flags().String("debug-file", "", "Path of the file log to")
Expand Down
1 change: 1 addition & 0 deletions completers/gh_completer/cmd/codespace_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var codespace_stopCmd = &cobra.Command{
}

func init() {
carapace.Gen(codespace_stopCmd).Standalone()
codespace_stopCmd.Flags().StringP("codespace", "c", "", "Name of the codespace")
codespaceCmd.AddCommand(codespace_stopCmd)

Expand Down
3 changes: 2 additions & 1 deletion completers/gh_completer/cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
)

var completionCmd = &cobra.Command{
Use: "completion -s <shell>",
Use: "completion",
Short: "Generate shell completion scripts",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(completionCmd).Standalone()
completionCmd.Flags().StringP("shell", "s", "", "Shell type: {bash|zsh|fish|powershell}")
rootCmd.AddCommand(completionCmd)

Expand Down
4 changes: 3 additions & 1 deletion completers/gh_completer/cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var configCmd = &cobra.Command{
Use: "config <command>",
Use: "config",
Short: "Manage configuration for gh",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(configCmd).Standalone()
rootCmd.AddCommand(configCmd)
}
3 changes: 2 additions & 1 deletion completers/gh_completer/cmd/config_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
)

var config_getCmd = &cobra.Command{
Use: "get <key>",
Use: "get",
Short: "Print the value of a given configuration key",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(config_getCmd).Standalone()
config_getCmd.Flags().StringP("host", "h", "", "Get per-host setting")
configCmd.AddCommand(config_getCmd)

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

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

var config_listCmd = &cobra.Command{
Use: "list",
Short: "Print a list of configuration keys and values",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(config_listCmd).Standalone()
config_listCmd.Flags().StringP("host", "h", "", "Get per-host configuration")
configCmd.AddCommand(config_listCmd)

carapace.Gen(config_listCmd).FlagCompletion(carapace.ActionMap{
"host": action.ActionConfigHosts(),
})
}
Loading

0 comments on commit be6cb37

Please sign in to comment.