From ffdf1167028e4cccae4cfdbb61ed2f9054eed87a Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 2 Dec 2021 19:24:23 +0100 Subject: [PATCH] gh: updates from 2.3.0 --- completers/gh_completer/cmd/actions.go | 4 +++- completers/gh_completer/cmd/alias.go | 5 +++- completers/gh_completer/cmd/alias_delete.go | 3 ++- completers/gh_completer/cmd/alias_list.go | 2 ++ completers/gh_completer/cmd/alias_set.go | 4 +++- completers/gh_completer/cmd/api.go | 5 ++-- completers/gh_completer/cmd/auth.go | 4 +++- completers/gh_completer/cmd/auth_login.go | 1 + completers/gh_completer/cmd/auth_logout.go | 2 ++ completers/gh_completer/cmd/auth_refresh.go | 2 ++ completers/gh_completer/cmd/auth_setupGit.go | 23 ++++++++++++++++++ completers/gh_completer/cmd/auth_status.go | 1 + completers/gh_completer/cmd/browse.go | 3 ++- completers/gh_completer/cmd/codespace.go | 2 ++ completers/gh_completer/cmd/codespace_code.go | 1 + completers/gh_completer/cmd/codespace_cp.go | 1 + .../gh_completer/cmd/codespace_create.go | 2 ++ .../gh_completer/cmd/codespace_delete.go | 1 + completers/gh_completer/cmd/codespace_list.go | 1 + completers/gh_completer/cmd/codespace_logs.go | 1 + .../gh_completer/cmd/codespace_ports.go | 1 + .../cmd/codespace_ports_forward.go | 1 + .../cmd/codespace_ports_visibility.go | 1 + completers/gh_completer/cmd/codespace_ssh.go | 1 + completers/gh_completer/cmd/codespace_stop.go | 1 + completers/gh_completer/cmd/completion.go | 3 ++- completers/gh_completer/cmd/config.go | 4 +++- completers/gh_completer/cmd/config_get.go | 3 ++- completers/gh_completer/cmd/config_list.go | 23 ++++++++++++++++++ completers/gh_completer/cmd/config_set.go | 3 ++- completers/gh_completer/cmd/extension.go | 2 ++ .../gh_completer/cmd/extension_create.go | 7 ++++++ .../gh_completer/cmd/extension_install.go | 1 + completers/gh_completer/cmd/extension_list.go | 2 ++ .../gh_completer/cmd/extension_remove.go | 1 + .../gh_completer/cmd/extension_upgrade.go | 1 + completers/gh_completer/cmd/gist.go | 4 +++- completers/gh_completer/cmd/gist_clone.go | 3 ++- completers/gh_completer/cmd/gist_create.go | 7 +++--- completers/gh_completer/cmd/gist_delete.go | 3 ++- completers/gh_completer/cmd/gist_edit.go | 3 ++- completers/gh_completer/cmd/gist_list.go | 2 ++ completers/gh_completer/cmd/gist_view.go | 2 +- completers/gh_completer/cmd/gpgKey.go | 2 ++ completers/gh_completer/cmd/gpgKey_add.go | 1 + completers/gh_completer/cmd/gpgKey_list.go | 2 ++ completers/gh_completer/cmd/help.go | 17 +++++++++++++ completers/gh_completer/cmd/issue.go | 3 ++- completers/gh_completer/cmd/issue_close.go | 3 ++- completers/gh_completer/cmd/issue_comment.go | 5 ++-- completers/gh_completer/cmd/issue_create.go | 9 +++---- completers/gh_completer/cmd/issue_delete.go | 3 ++- completers/gh_completer/cmd/issue_edit.go | 17 ++++++------- completers/gh_completer/cmd/issue_list.go | 12 +++++----- completers/gh_completer/cmd/issue_reopen.go | 3 ++- completers/gh_completer/cmd/issue_status.go | 3 ++- completers/gh_completer/cmd/issue_transfer.go | 3 ++- completers/gh_completer/cmd/issue_view.go | 5 ++-- completers/gh_completer/cmd/pr.go | 3 ++- completers/gh_completer/cmd/pr_checkout.go | 7 +++--- completers/gh_completer/cmd/pr_checks.go | 3 ++- completers/gh_completer/cmd/pr_close.go | 3 ++- completers/gh_completer/cmd/pr_comment.go | 5 ++-- completers/gh_completer/cmd/pr_create.go | 9 +++---- completers/gh_completer/cmd/pr_diff.go | 3 ++- completers/gh_completer/cmd/pr_edit.go | 21 ++++++++-------- completers/gh_completer/cmd/pr_list.go | 9 +++---- completers/gh_completer/cmd/pr_merge.go | 5 ++-- completers/gh_completer/cmd/pr_ready.go | 3 ++- completers/gh_completer/cmd/pr_reopen.go | 3 ++- completers/gh_completer/cmd/pr_review.go | 5 ++-- completers/gh_completer/cmd/pr_status.go | 3 ++- completers/gh_completer/cmd/pr_view.go | 5 ++-- completers/gh_completer/cmd/release.go | 3 ++- completers/gh_completer/cmd/release_create.go | 5 ++-- completers/gh_completer/cmd/release_delete.go | 3 ++- .../gh_completer/cmd/release_download.go | 9 ++++--- completers/gh_completer/cmd/release_list.go | 2 ++ completers/gh_completer/cmd/release_upload.go | 3 ++- completers/gh_completer/cmd/release_view.go | 5 ++-- completers/gh_completer/cmd/repo.go | 4 +++- completers/gh_completer/cmd/repo_archive.go | 4 +++- completers/gh_completer/cmd/repo_clone.go | 3 ++- completers/gh_completer/cmd/repo_create.go | 10 +++++++- completers/gh_completer/cmd/repo_delete.go | 1 + completers/gh_completer/cmd/repo_fork.go | 3 ++- completers/gh_completer/cmd/repo_list.go | 7 +++--- completers/gh_completer/cmd/repo_rename.go | 24 +++++++++++++++++++ completers/gh_completer/cmd/repo_sync.go | 1 + completers/gh_completer/cmd/repo_view.go | 5 ++-- completers/gh_completer/cmd/root.go | 3 ++- completers/gh_completer/cmd/run.go | 3 ++- completers/gh_completer/cmd/run_cancel.go | 1 + completers/gh_completer/cmd/run_download.go | 5 ++-- completers/gh_completer/cmd/run_list.go | 1 + completers/gh_completer/cmd/run_rerun.go | 3 ++- completers/gh_completer/cmd/run_view.go | 3 ++- completers/gh_completer/cmd/run_watch.go | 3 ++- completers/gh_completer/cmd/secret.go | 3 ++- completers/gh_completer/cmd/secret_list.go | 2 ++ completers/gh_completer/cmd/secret_remove.go | 8 ++++--- completers/gh_completer/cmd/secret_set.go | 15 +++++++----- completers/gh_completer/cmd/sshKey.go | 4 +++- completers/gh_completer/cmd/sshKey_add.go | 3 ++- completers/gh_completer/cmd/sshKey_list.go | 2 ++ completers/gh_completer/cmd/workflow.go | 3 ++- .../gh_completer/cmd/workflow_disable.go | 3 ++- .../gh_completer/cmd/workflow_enable.go | 3 ++- completers/gh_completer/cmd/workflow_list.go | 4 ++++ completers/gh_completer/cmd/workflow_run.go | 7 +++--- completers/gh_completer/cmd/workflow_view.go | 3 ++- 111 files changed, 366 insertions(+), 130 deletions(-) create mode 100644 completers/gh_completer/cmd/auth_setupGit.go create mode 100644 completers/gh_completer/cmd/config_list.go create mode 100644 completers/gh_completer/cmd/help.go create mode 100644 completers/gh_completer/cmd/repo_rename.go diff --git a/completers/gh_completer/cmd/actions.go b/completers/gh_completer/cmd/actions.go index 5fbb23639a..bb1704b24b 100644 --- a/completers/gh_completer/cmd/actions.go +++ b/completers/gh_completer/cmd/actions.go @@ -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) } diff --git a/completers/gh_completer/cmd/alias.go b/completers/gh_completer/cmd/alias.go index 98c717bee3..bb0144bf4a 100644 --- a/completers/gh_completer/cmd/alias.go +++ b/completers/gh_completer/cmd/alias.go @@ -1,14 +1,17 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) var aliasCmd = &cobra.Command{ - Use: "alias ", + Use: "alias", Short: "Create command shortcuts", + Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(aliasCmd).Standalone() rootCmd.AddCommand(aliasCmd) } diff --git a/completers/gh_completer/cmd/alias_delete.go b/completers/gh_completer/cmd/alias_delete.go index 879bb142d9..e130660819 100644 --- a/completers/gh_completer/cmd/alias_delete.go +++ b/completers/gh_completer/cmd/alias_delete.go @@ -7,12 +7,13 @@ import ( ) var alias_deleteCmd = &cobra.Command{ - Use: "delete ", + 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( diff --git a/completers/gh_completer/cmd/alias_list.go b/completers/gh_completer/cmd/alias_list.go index 321211e439..c13667a3ac 100644 --- a/completers/gh_completer/cmd/alias_list.go +++ b/completers/gh_completer/cmd/alias_list.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,6 @@ var alias_listCmd = &cobra.Command{ } func init() { + carapace.Gen(alias_listCmd).Standalone() aliasCmd.AddCommand(alias_listCmd) } diff --git a/completers/gh_completer/cmd/alias_set.go b/completers/gh_completer/cmd/alias_set.go index 62143fc40d..8eb011d795 100644 --- a/completers/gh_completer/cmd/alias_set.go +++ b/completers/gh_completer/cmd/alias_set.go @@ -1,16 +1,18 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) var alias_setCmd = &cobra.Command{ - Use: "set ", + 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) } diff --git a/completers/gh_completer/cmd/api.go b/completers/gh_completer/cmd/api.go index 2df3ea725c..672b3d1466 100644 --- a/completers/gh_completer/cmd/api.go +++ b/completers/gh_completer/cmd/api.go @@ -7,12 +7,14 @@ import ( ) var apiCmd = &cobra.Command{ - Use: "api ", + 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\")") @@ -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{ diff --git a/completers/gh_completer/cmd/auth.go b/completers/gh_completer/cmd/auth.go index 3d68714043..32962de4f4 100644 --- a/completers/gh_completer/cmd/auth.go +++ b/completers/gh_completer/cmd/auth.go @@ -1,15 +1,17 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) var authCmd = &cobra.Command{ - Use: "auth ", + 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) } diff --git a/completers/gh_completer/cmd/auth_login.go b/completers/gh_completer/cmd/auth_login.go index b145118b67..d90abf762e 100644 --- a/completers/gh_completer/cmd/auth_login.go +++ b/completers/gh_completer/cmd/auth_login.go @@ -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") diff --git a/completers/gh_completer/cmd/auth_logout.go b/completers/gh_completer/cmd/auth_logout.go index ed031e90a3..95b84cf9b2 100644 --- a/completers/gh_completer/cmd/auth_logout.go +++ b/completers/gh_completer/cmd/auth_logout.go @@ -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) diff --git a/completers/gh_completer/cmd/auth_refresh.go b/completers/gh_completer/cmd/auth_refresh.go index 16960cc176..3aa2445553 100644 --- a/completers/gh_completer/cmd/auth_refresh.go +++ b/completers/gh_completer/cmd/auth_refresh.go @@ -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) diff --git a/completers/gh_completer/cmd/auth_setupGit.go b/completers/gh_completer/cmd/auth_setupGit.go new file mode 100644 index 0000000000..c02c6e93e8 --- /dev/null +++ b/completers/gh_completer/cmd/auth_setupGit.go @@ -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(), + }) +} diff --git a/completers/gh_completer/cmd/auth_status.go b/completers/gh_completer/cmd/auth_status.go index 26b5535254..0a3af641b1 100644 --- a/completers/gh_completer/cmd/auth_status.go +++ b/completers/gh_completer/cmd/auth_status.go @@ -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) diff --git a/completers/gh_completer/cmd/browse.go b/completers/gh_completer/cmd/browse.go index c261f70f62..3fe663805a 100644 --- a/completers/gh_completer/cmd/browse.go +++ b/completers/gh_completer/cmd/browse.go @@ -15,12 +15,13 @@ import ( ) var browseCmd = &cobra.Command{ - Use: "browse [ | ]", + 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") diff --git a/completers/gh_completer/cmd/codespace.go b/completers/gh_completer/cmd/codespace.go index 0dc5f1a608..4a8e1fd532 100644 --- a/completers/gh_completer/cmd/codespace.go +++ b/completers/gh_completer/cmd/codespace.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,6 @@ var codespaceCmd = &cobra.Command{ } func init() { + carapace.Gen(codespaceCmd).Standalone() rootCmd.AddCommand(codespaceCmd) } diff --git a/completers/gh_completer/cmd/codespace_code.go b/completers/gh_completer/cmd/codespace_code.go index 68c3180b5f..b37fb95f86 100644 --- a/completers/gh_completer/cmd/codespace_code.go +++ b/completers/gh_completer/cmd/codespace_code.go @@ -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) diff --git a/completers/gh_completer/cmd/codespace_cp.go b/completers/gh_completer/cmd/codespace_cp.go index 5e32e1627a..bc61460140 100644 --- a/completers/gh_completer/cmd/codespace_cp.go +++ b/completers/gh_completer/cmd/codespace_cp.go @@ -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") diff --git a/completers/gh_completer/cmd/codespace_create.go b/completers/gh_completer/cmd/codespace_create.go index d3404bdb7e..ed3452fd58 100644 --- a/completers/gh_completer/cmd/codespace_create.go +++ b/completers/gh_completer/cmd/codespace_create.go @@ -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") diff --git a/completers/gh_completer/cmd/codespace_delete.go b/completers/gh_completer/cmd/codespace_delete.go index f0acd359f7..27aed2c790 100644 --- a/completers/gh_completer/cmd/codespace_delete.go +++ b/completers/gh_completer/cmd/codespace_delete.go @@ -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") diff --git a/completers/gh_completer/cmd/codespace_list.go b/completers/gh_completer/cmd/codespace_list.go index 9503f90d48..084ab6d6c7 100644 --- a/completers/gh_completer/cmd/codespace_list.go +++ b/completers/gh_completer/cmd/codespace_list.go @@ -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") diff --git a/completers/gh_completer/cmd/codespace_logs.go b/completers/gh_completer/cmd/codespace_logs.go index c18ad86aab..12021b169e 100644 --- a/completers/gh_completer/cmd/codespace_logs.go +++ b/completers/gh_completer/cmd/codespace_logs.go @@ -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) diff --git a/completers/gh_completer/cmd/codespace_ports.go b/completers/gh_completer/cmd/codespace_ports.go index 8bba3e611f..6b8127efa5 100644 --- a/completers/gh_completer/cmd/codespace_ports.go +++ b/completers/gh_completer/cmd/codespace_ports.go @@ -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`") diff --git a/completers/gh_completer/cmd/codespace_ports_forward.go b/completers/gh_completer/cmd/codespace_ports_forward.go index dfb7eefc3d..48d2f600c7 100644 --- a/completers/gh_completer/cmd/codespace_ports_forward.go +++ b/completers/gh_completer/cmd/codespace_ports_forward.go @@ -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( diff --git a/completers/gh_completer/cmd/codespace_ports_visibility.go b/completers/gh_completer/cmd/codespace_ports_visibility.go index 1c3f1908f8..eb4ea2500e 100644 --- a/completers/gh_completer/cmd/codespace_ports_visibility.go +++ b/completers/gh_completer/cmd/codespace_ports_visibility.go @@ -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( diff --git a/completers/gh_completer/cmd/codespace_ssh.go b/completers/gh_completer/cmd/codespace_ssh.go index 579c8bc74e..b92a874118 100644 --- a/completers/gh_completer/cmd/codespace_ssh.go +++ b/completers/gh_completer/cmd/codespace_ssh.go @@ -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") diff --git a/completers/gh_completer/cmd/codespace_stop.go b/completers/gh_completer/cmd/codespace_stop.go index 222745ac1d..21cccd05be 100644 --- a/completers/gh_completer/cmd/codespace_stop.go +++ b/completers/gh_completer/cmd/codespace_stop.go @@ -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) diff --git a/completers/gh_completer/cmd/completion.go b/completers/gh_completer/cmd/completion.go index b04019ce8a..736a6e6a94 100644 --- a/completers/gh_completer/cmd/completion.go +++ b/completers/gh_completer/cmd/completion.go @@ -6,12 +6,13 @@ import ( ) var completionCmd = &cobra.Command{ - Use: "completion -s ", + 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) diff --git a/completers/gh_completer/cmd/config.go b/completers/gh_completer/cmd/config.go index e567b0e10e..cb42deb15b 100644 --- a/completers/gh_completer/cmd/config.go +++ b/completers/gh_completer/cmd/config.go @@ -1,15 +1,17 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) var configCmd = &cobra.Command{ - Use: "config ", + Use: "config", Short: "Manage configuration for gh", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(configCmd).Standalone() rootCmd.AddCommand(configCmd) } diff --git a/completers/gh_completer/cmd/config_get.go b/completers/gh_completer/cmd/config_get.go index be32cc4d2d..892a5d075f 100644 --- a/completers/gh_completer/cmd/config_get.go +++ b/completers/gh_completer/cmd/config_get.go @@ -7,12 +7,13 @@ import ( ) var config_getCmd = &cobra.Command{ - Use: "get ", + 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) diff --git a/completers/gh_completer/cmd/config_list.go b/completers/gh_completer/cmd/config_list.go new file mode 100644 index 0000000000..eb943a37a1 --- /dev/null +++ b/completers/gh_completer/cmd/config_list.go @@ -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(), + }) +} diff --git a/completers/gh_completer/cmd/config_set.go b/completers/gh_completer/cmd/config_set.go index 6da1455df1..cc52eacafa 100644 --- a/completers/gh_completer/cmd/config_set.go +++ b/completers/gh_completer/cmd/config_set.go @@ -7,12 +7,13 @@ import ( ) var config_setCmd = &cobra.Command{ - Use: "set ", + Use: "set", Short: "Update configuration with a value for the given key", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(config_setCmd).Standalone() config_setCmd.Flags().StringP("host", "h", "", "Set per-host setting") configCmd.AddCommand(config_setCmd) diff --git a/completers/gh_completer/cmd/extension.go b/completers/gh_completer/cmd/extension.go index 912b5646f8..4eae6808dc 100644 --- a/completers/gh_completer/cmd/extension.go +++ b/completers/gh_completer/cmd/extension.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,6 @@ var extensionCmd = &cobra.Command{ } func init() { + carapace.Gen(extensionCmd).Standalone() rootCmd.AddCommand(extensionCmd) } diff --git a/completers/gh_completer/cmd/extension_create.go b/completers/gh_completer/cmd/extension_create.go index 9d0c283dec..85a3ccff45 100644 --- a/completers/gh_completer/cmd/extension_create.go +++ b/completers/gh_completer/cmd/extension_create.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,11 @@ var extension_createCmd = &cobra.Command{ } func init() { + carapace.Gen(extension_createCmd).Standalone() + extension_createCmd.Flags().String("precompiled", "", "Create a precompiled extension. Possible values: go, other") extensionCmd.AddCommand(extension_createCmd) + + carapace.Gen(extension_createCmd).FlagCompletion(carapace.ActionMap{ + "precompiled": carapace.ActionValues("go", "other"), + }) } diff --git a/completers/gh_completer/cmd/extension_install.go b/completers/gh_completer/cmd/extension_install.go index e367daab9c..a95c720f39 100644 --- a/completers/gh_completer/cmd/extension_install.go +++ b/completers/gh_completer/cmd/extension_install.go @@ -13,6 +13,7 @@ var extension_installCmd = &cobra.Command{ } func init() { + carapace.Gen(extension_installCmd).Standalone() extensionCmd.AddCommand(extension_installCmd) carapace.Gen(extension_installCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/extension_list.go b/completers/gh_completer/cmd/extension_list.go index 7fd7bf818d..cf2a55cded 100644 --- a/completers/gh_completer/cmd/extension_list.go +++ b/completers/gh_completer/cmd/extension_list.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,6 @@ var extension_listCmd = &cobra.Command{ } func init() { + carapace.Gen(extension_listCmd).Standalone() extensionCmd.AddCommand(extension_listCmd) } diff --git a/completers/gh_completer/cmd/extension_remove.go b/completers/gh_completer/cmd/extension_remove.go index c55f15f90e..2fbbd6c61a 100644 --- a/completers/gh_completer/cmd/extension_remove.go +++ b/completers/gh_completer/cmd/extension_remove.go @@ -13,6 +13,7 @@ var extension_removeCmd = &cobra.Command{ } func init() { + carapace.Gen(extension_removeCmd).Standalone() extensionCmd.AddCommand(extension_removeCmd) carapace.Gen(extension_removeCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/extension_upgrade.go b/completers/gh_completer/cmd/extension_upgrade.go index d213d283e5..fd61139924 100644 --- a/completers/gh_completer/cmd/extension_upgrade.go +++ b/completers/gh_completer/cmd/extension_upgrade.go @@ -13,6 +13,7 @@ var extension_upgradeCmd = &cobra.Command{ } func init() { + carapace.Gen(extension_upgradeCmd).Standalone() extension_upgradeCmd.Flags().Bool("all", false, "Upgrade all extensions") extension_upgradeCmd.Flags().Bool("force", false, "Force upgrade extension") extensionCmd.AddCommand(extension_upgradeCmd) diff --git a/completers/gh_completer/cmd/gist.go b/completers/gh_completer/cmd/gist.go index 5c529a363a..6e336b0c23 100644 --- a/completers/gh_completer/cmd/gist.go +++ b/completers/gh_completer/cmd/gist.go @@ -1,15 +1,17 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) var gistCmd = &cobra.Command{ - Use: "gist ", + Use: "gist", Short: "Manage gists", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(gistCmd).Standalone() rootCmd.AddCommand(gistCmd) } diff --git a/completers/gh_completer/cmd/gist_clone.go b/completers/gh_completer/cmd/gist_clone.go index 9c0535036a..b7db08f63b 100644 --- a/completers/gh_completer/cmd/gist_clone.go +++ b/completers/gh_completer/cmd/gist_clone.go @@ -7,12 +7,13 @@ import ( ) var gist_cloneCmd = &cobra.Command{ - Use: "clone [] [-- ...]", + Use: "clone", Short: "Clone a gist locally", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(gist_cloneCmd).Standalone() gistCmd.AddCommand(gist_cloneCmd) carapace.Gen(gist_cloneCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/gist_create.go b/completers/gh_completer/cmd/gist_create.go index 6df637f823..d449b64fbd 100644 --- a/completers/gh_completer/cmd/gist_create.go +++ b/completers/gh_completer/cmd/gist_create.go @@ -6,15 +6,16 @@ import ( ) var gist_createCmd = &cobra.Command{ - Use: "create [... | -]", + Use: "create", Short: "Create a new gist", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(gist_createCmd).Standalone() gist_createCmd.Flags().StringP("desc", "d", "", "A description for this gist") - gist_createCmd.Flags().StringP("filename", "f", "", "Provide a filename to be used when reading from STDIN") - gist_createCmd.Flags().BoolP("public", "p", false, "List the gist publicly (default: private)") + gist_createCmd.Flags().StringP("filename", "f", "", "Provide a filename to be used when reading from standard input") + gist_createCmd.Flags().BoolP("public", "p", false, "List the gist publicly (default: secret)") gist_createCmd.Flags().BoolP("web", "w", false, "Open the web browser with created gist") gistCmd.AddCommand(gist_createCmd) diff --git a/completers/gh_completer/cmd/gist_delete.go b/completers/gh_completer/cmd/gist_delete.go index 38e6d75bd7..090019b06d 100644 --- a/completers/gh_completer/cmd/gist_delete.go +++ b/completers/gh_completer/cmd/gist_delete.go @@ -7,12 +7,13 @@ import ( ) var gist_deleteCmd = &cobra.Command{ - Use: "delete { | }", + Use: "delete", Short: "Delete a gist", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(gist_deleteCmd).Standalone() gistCmd.AddCommand(gist_deleteCmd) carapace.Gen(gist_deleteCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/gist_edit.go b/completers/gh_completer/cmd/gist_edit.go index 0e172705c6..1c048922cd 100644 --- a/completers/gh_completer/cmd/gist_edit.go +++ b/completers/gh_completer/cmd/gist_edit.go @@ -7,12 +7,13 @@ import ( ) var gist_editCmd = &cobra.Command{ - Use: "edit { | }", + Use: "edit", Short: "Edit one of your gists", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(gist_editCmd).Standalone() gist_editCmd.Flags().StringP("add", "a", "", "Add a new file to the gist") gist_editCmd.Flags().StringP("filename", "f", "", "Select a file to edit") gistCmd.AddCommand(gist_editCmd) diff --git a/completers/gh_completer/cmd/gist_list.go b/completers/gh_completer/cmd/gist_list.go index 33695eb490..a357c8125c 100644 --- a/completers/gh_completer/cmd/gist_list.go +++ b/completers/gh_completer/cmd/gist_list.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,6 +12,7 @@ var gist_listCmd = &cobra.Command{ } func init() { + carapace.Gen(gist_listCmd).Standalone() gist_listCmd.Flags().IntP("limit", "L", 10, "Maximum number of gists to fetch") gist_listCmd.Flags().Bool("public", false, "Show only public gists") gist_listCmd.Flags().Bool("secret", false, "Show only secret gists") diff --git a/completers/gh_completer/cmd/gist_view.go b/completers/gh_completer/cmd/gist_view.go index 1f2af1a171..348b1d06fe 100644 --- a/completers/gh_completer/cmd/gist_view.go +++ b/completers/gh_completer/cmd/gist_view.go @@ -7,7 +7,7 @@ import ( ) var gist_viewCmd = &cobra.Command{ - Use: "view [ | ]", + Use: "view", Short: "View a gist", Run: func(cmd *cobra.Command, args []string) {}, } diff --git a/completers/gh_completer/cmd/gpgKey.go b/completers/gh_completer/cmd/gpgKey.go index 3f647883af..cc55bd4c58 100644 --- a/completers/gh_completer/cmd/gpgKey.go +++ b/completers/gh_completer/cmd/gpgKey.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,6 @@ var gpgKeyCmd = &cobra.Command{ } func init() { + carapace.Gen(gpgKeyCmd).Standalone() rootCmd.AddCommand(gpgKeyCmd) } diff --git a/completers/gh_completer/cmd/gpgKey_add.go b/completers/gh_completer/cmd/gpgKey_add.go index 3f6bde5782..45da0cef92 100644 --- a/completers/gh_completer/cmd/gpgKey_add.go +++ b/completers/gh_completer/cmd/gpgKey_add.go @@ -12,6 +12,7 @@ var gpgKey_addCmd = &cobra.Command{ } func init() { + carapace.Gen(gpgKey_addCmd).Standalone() gpgKeyCmd.AddCommand(gpgKey_addCmd) carapace.Gen(gpgKey_addCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/gpgKey_list.go b/completers/gh_completer/cmd/gpgKey_list.go index 859c97157b..36b085392b 100644 --- a/completers/gh_completer/cmd/gpgKey_list.go +++ b/completers/gh_completer/cmd/gpgKey_list.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,6 @@ var gpgKey_listCmd = &cobra.Command{ } func init() { + carapace.Gen(gpgKey_listCmd).Standalone() gpgKeyCmd.AddCommand(gpgKey_listCmd) } diff --git a/completers/gh_completer/cmd/help.go b/completers/gh_completer/cmd/help.go new file mode 100644 index 0000000000..f55758d2d7 --- /dev/null +++ b/completers/gh_completer/cmd/help.go @@ -0,0 +1,17 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var helpCmd = &cobra.Command{ + Use: "help", + Short: "Help about any command", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(helpCmd).Standalone() + rootCmd.AddCommand(helpCmd) +} diff --git a/completers/gh_completer/cmd/issue.go b/completers/gh_completer/cmd/issue.go index 46a8db6baf..daf42aa2d9 100644 --- a/completers/gh_completer/cmd/issue.go +++ b/completers/gh_completer/cmd/issue.go @@ -7,12 +7,13 @@ import ( ) var issueCmd = &cobra.Command{ - Use: "issue ", + Use: "issue", Short: "Manage issues", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(issueCmd).Standalone() issueCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") rootCmd.AddCommand(issueCmd) diff --git a/completers/gh_completer/cmd/issue_close.go b/completers/gh_completer/cmd/issue_close.go index 71ae2c8d03..b923f32850 100644 --- a/completers/gh_completer/cmd/issue_close.go +++ b/completers/gh_completer/cmd/issue_close.go @@ -7,12 +7,13 @@ import ( ) var issue_closeCmd = &cobra.Command{ - Use: "close { | }", + Use: "close", Short: "Close issue", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(issue_closeCmd).Standalone() issueCmd.AddCommand(issue_closeCmd) carapace.Gen(issue_closeCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/issue_comment.go b/completers/gh_completer/cmd/issue_comment.go index 2bb7bc3dda..0c9519e884 100644 --- a/completers/gh_completer/cmd/issue_comment.go +++ b/completers/gh_completer/cmd/issue_comment.go @@ -7,14 +7,15 @@ import ( ) var issue_commentCmd = &cobra.Command{ - Use: "comment { | }", + Use: "comment", Short: "Create a new issue comment", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(issue_commentCmd).Standalone() issue_commentCmd.Flags().StringP("body", "b", "", "Supply a body. Will prompt for one otherwise.") - issue_commentCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") + issue_commentCmd.Flags().StringP("body-file", "F", "", "Read body text from `file` (use \"-\" to read from standard input)") issue_commentCmd.Flags().BoolP("editor", "e", false, "Add body using editor") issue_commentCmd.Flags().BoolP("web", "w", false, "Add body in browser") issueCmd.AddCommand(issue_commentCmd) diff --git a/completers/gh_completer/cmd/issue_create.go b/completers/gh_completer/cmd/issue_create.go index 1e30e7e138..75dc2b7c71 100644 --- a/completers/gh_completer/cmd/issue_create.go +++ b/completers/gh_completer/cmd/issue_create.go @@ -13,12 +13,13 @@ var issue_createCmd = &cobra.Command{ } func init() { - issue_createCmd.Flags().StringSliceP("assignee", "a", nil, "Assign people by their `login`. Use \"@me\" to self-assign.") + carapace.Gen(issue_createCmd).Standalone() + issue_createCmd.Flags().StringSliceP("assignee", "a", []string{}, "Assign people by their `login`. Use \"@me\" to self-assign.") issue_createCmd.Flags().StringP("body", "b", "", "Supply a body. Will prompt for one otherwise.") - issue_createCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") - issue_createCmd.Flags().StringSliceP("label", "l", nil, "Add labels by `name`") + issue_createCmd.Flags().StringP("body-file", "F", "", "Read body text from `file` (use \"-\" to read from standard input)") + issue_createCmd.Flags().StringSliceP("label", "l", []string{}, "Add labels by `name`") issue_createCmd.Flags().StringP("milestone", "m", "", "Add the issue to a milestone by `name`") - issue_createCmd.Flags().StringSliceP("project", "p", nil, "Add the issue to projects by `name`") + issue_createCmd.Flags().StringSliceP("project", "p", []string{}, "Add the issue to projects by `name`") issue_createCmd.Flags().String("recover", "", "Recover input from a failed run of create") issue_createCmd.Flags().StringP("title", "t", "", "Supply a title. Will prompt for one otherwise.") issue_createCmd.Flags().BoolP("web", "w", false, "Open the browser to create an issue") diff --git a/completers/gh_completer/cmd/issue_delete.go b/completers/gh_completer/cmd/issue_delete.go index 7978ce491e..9c028c8a84 100644 --- a/completers/gh_completer/cmd/issue_delete.go +++ b/completers/gh_completer/cmd/issue_delete.go @@ -7,12 +7,13 @@ import ( ) var issue_deleteCmd = &cobra.Command{ - Use: "delete { | }", + Use: "delete", Short: "Delete issue", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(issue_deleteCmd).Standalone() issueCmd.AddCommand(issue_deleteCmd) carapace.Gen(issue_deleteCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/issue_edit.go b/completers/gh_completer/cmd/issue_edit.go index 6a9f3cf484..d42d07fb85 100644 --- a/completers/gh_completer/cmd/issue_edit.go +++ b/completers/gh_completer/cmd/issue_edit.go @@ -7,21 +7,22 @@ import ( ) var issue_editCmd = &cobra.Command{ - Use: "edit { | }", + Use: "edit", Short: "Edit an issue", Run: func(cmd *cobra.Command, args []string) {}, } func init() { - issue_editCmd.Flags().StringSlice("add-assignee", nil, "Add assigned users by their `login`. Use \"@me\" to assign yourself.") - issue_editCmd.Flags().StringSlice("add-label", nil, "Add labels by `name`") - issue_editCmd.Flags().StringSlice("add-project", nil, "Add the issue to projects by `name`") + carapace.Gen(issue_editCmd).Standalone() + issue_editCmd.Flags().StringSlice("add-assignee", []string{}, "Add assigned users by their `login`. Use \"@me\" to assign yourself.") + issue_editCmd.Flags().StringSlice("add-label", []string{}, "Add labels by `name`") + issue_editCmd.Flags().StringSlice("add-project", []string{}, "Add the issue to projects by `name`") issue_editCmd.Flags().StringP("body", "b", "", "Set the new body.") - issue_editCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") + issue_editCmd.Flags().StringP("body-file", "F", "", "Read body text from `file` (use \"-\" to read from standard input)") issue_editCmd.Flags().StringP("milestone", "m", "", "Edit the milestone the issue belongs to by `name`") - issue_editCmd.Flags().StringSlice("remove-assignee", nil, "Remove assigned users by their `login`. Use \"@me\" to unassign yourself.") - issue_editCmd.Flags().StringSlice("remove-label", nil, "Remove labels by `name`") - issue_editCmd.Flags().StringSlice("remove-project", nil, "Remove the issue from projects by `name`") + issue_editCmd.Flags().StringSlice("remove-assignee", []string{}, "Remove assigned users by their `login`. Use \"@me\" to unassign yourself.") + issue_editCmd.Flags().StringSlice("remove-label", []string{}, "Remove labels by `name`") + issue_editCmd.Flags().StringSlice("remove-project", []string{}, "Remove the issue from projects by `name`") issue_editCmd.Flags().StringP("title", "t", "", "Set the new title.") issueCmd.AddCommand(issue_editCmd) diff --git a/completers/gh_completer/cmd/issue_list.go b/completers/gh_completer/cmd/issue_list.go index ed15cfb89e..37465fd71a 100644 --- a/completers/gh_completer/cmd/issue_list.go +++ b/completers/gh_completer/cmd/issue_list.go @@ -13,19 +13,19 @@ var issue_listCmd = &cobra.Command{ } func init() { + carapace.Gen(issue_listCmd).Standalone() issue_listCmd.Flags().StringP("assignee", "a", "", "Filter by assignee") - issue_listCmd.Flags().StringSliceP("label", "l", nil, "Filter by labels") - issue_listCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|all}") - issue_listCmd.Flags().BoolP("web", "w", false, "Open the browser to list the issue(s)") - issue_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch") issue_listCmd.Flags().StringP("author", "A", "", "Filter by author") issue_listCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - issue_listCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + issue_listCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") + issue_listCmd.Flags().StringSliceP("label", "l", []string{}, "Filter by labels") + issue_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch") issue_listCmd.Flags().String("mention", "", "Filter by mention") issue_listCmd.Flags().StringP("milestone", "m", "", "Filter by milestone `number` or `title`") issue_listCmd.Flags().StringP("search", "S", "", "Search issues with `query`") + issue_listCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|all}") issue_listCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") - + issue_listCmd.Flags().BoolP("web", "w", false, "Open the browser to list the issue(s)") issueCmd.AddCommand(issue_listCmd) carapace.Gen(issue_listCmd).FlagCompletion(carapace.ActionMap{ diff --git a/completers/gh_completer/cmd/issue_reopen.go b/completers/gh_completer/cmd/issue_reopen.go index fb0ba03752..169738015a 100644 --- a/completers/gh_completer/cmd/issue_reopen.go +++ b/completers/gh_completer/cmd/issue_reopen.go @@ -7,12 +7,13 @@ import ( ) var issue_reopenCmd = &cobra.Command{ - Use: "reopen { | }", + Use: "reopen", Short: "Reopen issue", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(issue_reopenCmd).Standalone() issueCmd.AddCommand(issue_reopenCmd) carapace.Gen(issue_reopenCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/issue_status.go b/completers/gh_completer/cmd/issue_status.go index 0d5721e2a2..5d4841f34d 100644 --- a/completers/gh_completer/cmd/issue_status.go +++ b/completers/gh_completer/cmd/issue_status.go @@ -13,8 +13,9 @@ var issue_statusCmd = &cobra.Command{ } func init() { + carapace.Gen(issue_statusCmd).Standalone() issue_statusCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - issue_statusCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + issue_statusCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") issue_statusCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") issueCmd.AddCommand(issue_statusCmd) diff --git a/completers/gh_completer/cmd/issue_transfer.go b/completers/gh_completer/cmd/issue_transfer.go index 779089703e..be3ffc5130 100644 --- a/completers/gh_completer/cmd/issue_transfer.go +++ b/completers/gh_completer/cmd/issue_transfer.go @@ -7,12 +7,13 @@ import ( ) var issue_transferCmd = &cobra.Command{ - Use: "transfer { | } ", + Use: "transfer", Short: "Transfer issue to another repository", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(issue_transferCmd).Standalone() issueCmd.AddCommand(issue_transferCmd) carapace.Gen(issue_transferCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/issue_view.go b/completers/gh_completer/cmd/issue_view.go index 0a96be2c2a..c6b5ae149d 100644 --- a/completers/gh_completer/cmd/issue_view.go +++ b/completers/gh_completer/cmd/issue_view.go @@ -7,15 +7,16 @@ import ( ) var issue_viewCmd = &cobra.Command{ - Use: "view { | }", + Use: "view", Short: "View an issue", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(issue_viewCmd).Standalone() issue_viewCmd.Flags().BoolP("comments", "c", false, "View issue comments") issue_viewCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - issue_viewCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + issue_viewCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") issue_viewCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") issue_viewCmd.Flags().BoolP("web", "w", false, "Open an issue in the browser") issueCmd.AddCommand(issue_viewCmd) diff --git a/completers/gh_completer/cmd/pr.go b/completers/gh_completer/cmd/pr.go index 36bba0def2..6fabdb56d5 100644 --- a/completers/gh_completer/cmd/pr.go +++ b/completers/gh_completer/cmd/pr.go @@ -7,12 +7,13 @@ import ( ) var prCmd = &cobra.Command{ - Use: "pr ", + Use: "pr", Short: "Manage pull requests", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(prCmd).Standalone() prCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") rootCmd.AddCommand(prCmd) diff --git a/completers/gh_completer/cmd/pr_checkout.go b/completers/gh_completer/cmd/pr_checkout.go index adbf168d26..ef2705cf17 100644 --- a/completers/gh_completer/cmd/pr_checkout.go +++ b/completers/gh_completer/cmd/pr_checkout.go @@ -7,16 +7,17 @@ import ( ) var pr_checkoutCmd = &cobra.Command{ - Use: "checkout { | | }", + Use: "checkout", Short: "Check out a pull request in git", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_checkoutCmd).Standalone() pr_checkoutCmd.Flags().StringP("branch", "b", "", "Local branch name to use (default: the name of the head branch)") - pr_checkoutCmd.Flags().BoolP("detach", "", false, "Checkout PR with a detached HEAD") + pr_checkoutCmd.Flags().Bool("detach", false, "Checkout PR with a detached HEAD") pr_checkoutCmd.Flags().BoolP("force", "f", false, "Reset the existing local branch to the latest state of the pull request") - pr_checkoutCmd.Flags().BoolP("recurse-submodules", "", false, "Update all submodules after checkout") + pr_checkoutCmd.Flags().Bool("recurse-submodules", false, "Update all submodules after checkout") prCmd.AddCommand(pr_checkoutCmd) carapace.Gen(pr_checkoutCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/pr_checks.go b/completers/gh_completer/cmd/pr_checks.go index 0fcffbcf05..5bb743256e 100644 --- a/completers/gh_completer/cmd/pr_checks.go +++ b/completers/gh_completer/cmd/pr_checks.go @@ -7,12 +7,13 @@ import ( ) var pr_checksCmd = &cobra.Command{ - Use: "checks [ | | ]", + Use: "checks", Short: "Show CI status for a single pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_checksCmd).Standalone() pr_checksCmd.Flags().BoolP("web", "w", false, "Open the web browser to show details about checks") prCmd.AddCommand(pr_checksCmd) diff --git a/completers/gh_completer/cmd/pr_close.go b/completers/gh_completer/cmd/pr_close.go index a420059e7b..c5786ff948 100644 --- a/completers/gh_completer/cmd/pr_close.go +++ b/completers/gh_completer/cmd/pr_close.go @@ -7,12 +7,13 @@ import ( ) var pr_closeCmd = &cobra.Command{ - Use: "close { | | }", + Use: "close", Short: "Close a pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_closeCmd).Standalone() pr_closeCmd.Flags().BoolP("delete-branch", "d", false, "Delete the local and remote branch after close") prCmd.AddCommand(pr_closeCmd) diff --git a/completers/gh_completer/cmd/pr_comment.go b/completers/gh_completer/cmd/pr_comment.go index c0388c239b..5eb3c2d34c 100644 --- a/completers/gh_completer/cmd/pr_comment.go +++ b/completers/gh_completer/cmd/pr_comment.go @@ -7,14 +7,15 @@ import ( ) var pr_commentCmd = &cobra.Command{ - Use: "comment [ | | ]", + Use: "comment", Short: "Create a new pr comment", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_commentCmd).Standalone() pr_commentCmd.Flags().StringP("body", "b", "", "Supply a body. Will prompt for one otherwise.") - pr_commentCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") + pr_commentCmd.Flags().StringP("body-file", "F", "", "Read body text from `file` (use \"-\" to read from standard input)") pr_commentCmd.Flags().BoolP("editor", "e", false, "Add body using editor") pr_commentCmd.Flags().BoolP("web", "w", false, "Add body in browser") prCmd.AddCommand(pr_commentCmd) diff --git a/completers/gh_completer/cmd/pr_create.go b/completers/gh_completer/cmd/pr_create.go index 773e7f94b9..1b8b2a94f2 100644 --- a/completers/gh_completer/cmd/pr_create.go +++ b/completers/gh_completer/cmd/pr_create.go @@ -13,19 +13,20 @@ var pr_createCmd = &cobra.Command{ } func init() { - pr_createCmd.Flags().StringSliceP("assignee", "a", nil, "Assign people by their `login`. Use \"@me\" to self-assign.") + carapace.Gen(pr_createCmd).Standalone() + pr_createCmd.Flags().StringSliceP("assignee", "a", []string{}, "Assign people by their `login`. Use \"@me\" to self-assign.") pr_createCmd.Flags().StringP("base", "B", "", "The `branch` into which you want your code merged") pr_createCmd.Flags().StringP("body", "b", "", "Body for the pull request") pr_createCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") pr_createCmd.Flags().BoolP("draft", "d", false, "Mark pull request as a draft") pr_createCmd.Flags().BoolP("fill", "f", false, "Do not prompt for title/body and just use commit info") pr_createCmd.Flags().StringP("head", "H", "", "The `branch` that contains commits for your pull request (default: current branch)") - pr_createCmd.Flags().StringSliceP("label", "l", nil, "Add labels by `name`") + pr_createCmd.Flags().StringSliceP("label", "l", []string{}, "Add labels by `name`") pr_createCmd.Flags().StringP("milestone", "m", "", "Add the pull request to a milestone by `name`") pr_createCmd.Flags().Bool("no-maintainer-edit", false, "Disable maintainer's ability to modify pull request") - pr_createCmd.Flags().StringSliceP("project", "p", nil, "Add the pull request to projects by `name`") + pr_createCmd.Flags().StringSliceP("project", "p", []string{}, "Add the pull request to projects by `name`") pr_createCmd.Flags().String("recover", "", "Recover input from a failed run of create") - pr_createCmd.Flags().StringSliceP("reviewer", "r", nil, "Request reviews from people or teams by their `handle`") + pr_createCmd.Flags().StringSliceP("reviewer", "r", []string{}, "Request reviews from people or teams by their `handle`") pr_createCmd.Flags().StringP("title", "t", "", "Title for the pull request") pr_createCmd.Flags().BoolP("web", "w", false, "Open the web browser to create a pull request") prCmd.AddCommand(pr_createCmd) diff --git a/completers/gh_completer/cmd/pr_diff.go b/completers/gh_completer/cmd/pr_diff.go index be4ad94650..f0a27433a2 100644 --- a/completers/gh_completer/cmd/pr_diff.go +++ b/completers/gh_completer/cmd/pr_diff.go @@ -7,12 +7,13 @@ import ( ) var pr_diffCmd = &cobra.Command{ - Use: "diff [ | | ]", + Use: "diff", Short: "View changes in a pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_diffCmd).Standalone() pr_diffCmd.Flags().String("color", "auto", "Use color in diff output: {always|never|auto}") pr_diffCmd.Flags().Bool("patch", false, "Display diff in patch format") prCmd.AddCommand(pr_diffCmd) diff --git a/completers/gh_completer/cmd/pr_edit.go b/completers/gh_completer/cmd/pr_edit.go index 93c15db86d..40ce222fd6 100644 --- a/completers/gh_completer/cmd/pr_edit.go +++ b/completers/gh_completer/cmd/pr_edit.go @@ -7,24 +7,25 @@ import ( ) var pr_editCmd = &cobra.Command{ - Use: "edit [ | | ]", + Use: "edit", Short: "Edit a pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { - pr_editCmd.Flags().StringSlice("add-assignee", nil, "Add assigned users by their `login`. Use \"@me\" to assign yourself.") - pr_editCmd.Flags().StringSlice("add-label", nil, "Add labels by `name`") - pr_editCmd.Flags().StringSlice("add-project", nil, "Add the pull request to projects by `name`") - pr_editCmd.Flags().StringSlice("add-reviewer", nil, "Add reviewers by their `login`.") + carapace.Gen(pr_editCmd).Standalone() + pr_editCmd.Flags().StringSlice("add-assignee", []string{}, "Add assigned users by their `login`. Use \"@me\" to assign yourself.") + pr_editCmd.Flags().StringSlice("add-label", []string{}, "Add labels by `name`") + pr_editCmd.Flags().StringSlice("add-project", []string{}, "Add the pull request to projects by `name`") + pr_editCmd.Flags().StringSlice("add-reviewer", []string{}, "Add reviewers by their `login`.") pr_editCmd.Flags().StringP("base", "B", "", "Change the base `branch` for this pull request") pr_editCmd.Flags().StringP("body", "b", "", "Set the new body.") - pr_editCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") + pr_editCmd.Flags().StringP("body-file", "F", "", "Read body text from `file` (use \"-\" to read from standard input)") pr_editCmd.Flags().StringP("milestone", "m", "", "Edit the milestone the pull request belongs to by `name`") - pr_editCmd.Flags().StringSlice("remove-assignee", nil, "Remove assigned users by their `login`. Use \"@me\" to unassign yourself.") - pr_editCmd.Flags().StringSlice("remove-label", nil, "Remove labels by `name`") - pr_editCmd.Flags().StringSlice("remove-project", nil, "Remove the pull request from projects by `name`") - pr_editCmd.Flags().StringSlice("remove-reviewer", nil, "Remove reviewers by their `login`.") + pr_editCmd.Flags().StringSlice("remove-assignee", []string{}, "Remove assigned users by their `login`. Use \"@me\" to unassign yourself.") + pr_editCmd.Flags().StringSlice("remove-label", []string{}, "Remove labels by `name`") + pr_editCmd.Flags().StringSlice("remove-project", []string{}, "Remove the pull request from projects by `name`") + pr_editCmd.Flags().StringSlice("remove-reviewer", []string{}, "Remove reviewers by their `login`.") pr_editCmd.Flags().StringP("title", "t", "", "Set the new title.") prCmd.AddCommand(pr_editCmd) diff --git a/completers/gh_completer/cmd/pr_list.go b/completers/gh_completer/cmd/pr_list.go index 0cbfdea6b1..3b504d40cc 100644 --- a/completers/gh_completer/cmd/pr_list.go +++ b/completers/gh_completer/cmd/pr_list.go @@ -13,19 +13,20 @@ var pr_listCmd = &cobra.Command{ } func init() { - pr_listCmd.Flags().BoolP("web", "w", false, "Open the browser to list the pull requests") - pr_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of items to fetch") + carapace.Gen(pr_listCmd).Standalone() pr_listCmd.Flags().StringP("assignee", "a", "", "Filter by assignee") pr_listCmd.Flags().StringP("author", "A", "", "Filter by author") pr_listCmd.Flags().StringP("base", "B", "", "Filter by base branch") pr_listCmd.Flags().BoolP("draft", "d", false, "Filter by draft state") pr_listCmd.Flags().StringP("head", "H", "", "Filter by head branch") pr_listCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - pr_listCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") - pr_listCmd.Flags().StringSliceP("label", "l", nil, "Filter by labels") + pr_listCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") + pr_listCmd.Flags().StringSliceP("label", "l", []string{}, "Filter by labels") + pr_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of items to fetch") pr_listCmd.Flags().StringP("search", "S", "", "Search pull requests with `query`") pr_listCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|merged|all}") pr_listCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") + pr_listCmd.Flags().BoolP("web", "w", false, "Open the browser to list the pull requests") prCmd.AddCommand(pr_listCmd) carapace.Gen(pr_listCmd).FlagCompletion(carapace.ActionMap{ diff --git a/completers/gh_completer/cmd/pr_merge.go b/completers/gh_completer/cmd/pr_merge.go index 05dc482eb4..8887b97626 100644 --- a/completers/gh_completer/cmd/pr_merge.go +++ b/completers/gh_completer/cmd/pr_merge.go @@ -7,16 +7,17 @@ import ( ) var pr_mergeCmd = &cobra.Command{ - Use: "merge [ | | ]", + Use: "merge", Short: "Merge a pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_mergeCmd).Standalone() pr_mergeCmd.Flags().Bool("admin", false, "Use administrator privileges to merge a pull request that does not meet requirements") pr_mergeCmd.Flags().Bool("auto", false, "Automatically merge only after necessary requirements are met") pr_mergeCmd.Flags().StringP("body", "b", "", "Body `text` for the merge commit") - pr_mergeCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") + pr_mergeCmd.Flags().StringP("body-file", "F", "", "Read body text from `file` (use \"-\" to read from standard input)") pr_mergeCmd.Flags().BoolP("delete-branch", "d", false, "Delete the local and remote branch after merge") pr_mergeCmd.Flags().Bool("disable-auto", false, "Disable auto-merge for this pull request") pr_mergeCmd.Flags().BoolP("merge", "m", false, "Merge the commits with the base branch") diff --git a/completers/gh_completer/cmd/pr_ready.go b/completers/gh_completer/cmd/pr_ready.go index 2e317bd198..513a2da245 100644 --- a/completers/gh_completer/cmd/pr_ready.go +++ b/completers/gh_completer/cmd/pr_ready.go @@ -7,12 +7,13 @@ import ( ) var pr_readyCmd = &cobra.Command{ - Use: "ready [ | | ]", + Use: "ready", Short: "Mark a pull request as ready for review", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_readyCmd).Standalone() prCmd.AddCommand(pr_readyCmd) carapace.Gen(pr_readyCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/pr_reopen.go b/completers/gh_completer/cmd/pr_reopen.go index 4db6024ec0..f86d5bb2dd 100644 --- a/completers/gh_completer/cmd/pr_reopen.go +++ b/completers/gh_completer/cmd/pr_reopen.go @@ -7,12 +7,13 @@ import ( ) var pr_reopenCmd = &cobra.Command{ - Use: "reopen { | | }", + Use: "reopen", Short: "Reopen a pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_reopenCmd).Standalone() prCmd.AddCommand(pr_reopenCmd) carapace.Gen(pr_reopenCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/pr_review.go b/completers/gh_completer/cmd/pr_review.go index 566b95d865..89ba90a800 100644 --- a/completers/gh_completer/cmd/pr_review.go +++ b/completers/gh_completer/cmd/pr_review.go @@ -7,15 +7,16 @@ import ( ) var pr_reviewCmd = &cobra.Command{ - Use: "review [ | | ]", + Use: "review", Short: "Add a review to a pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_reviewCmd).Standalone() pr_reviewCmd.Flags().BoolP("approve", "a", false, "Approve pull request") pr_reviewCmd.Flags().StringP("body", "b", "", "Specify the body of a review") - pr_reviewCmd.Flags().StringP("body-file", "F", "", "Read body text from `file`") + pr_reviewCmd.Flags().StringP("body-file", "F", "", "Read body text from `file` (use \"-\" to read from standard input)") pr_reviewCmd.Flags().BoolP("comment", "c", false, "Comment on a pull request") pr_reviewCmd.Flags().BoolP("request-changes", "r", false, "Request changes on a pull request") prCmd.AddCommand(pr_reviewCmd) diff --git a/completers/gh_completer/cmd/pr_status.go b/completers/gh_completer/cmd/pr_status.go index 86e2f95fe9..8876de9e58 100644 --- a/completers/gh_completer/cmd/pr_status.go +++ b/completers/gh_completer/cmd/pr_status.go @@ -13,8 +13,9 @@ var pr_statusCmd = &cobra.Command{ } func init() { + carapace.Gen(pr_statusCmd).Standalone() pr_statusCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - pr_statusCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + pr_statusCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") pr_statusCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") prCmd.AddCommand(pr_statusCmd) diff --git a/completers/gh_completer/cmd/pr_view.go b/completers/gh_completer/cmd/pr_view.go index b6df139dcd..d68a3b8750 100644 --- a/completers/gh_completer/cmd/pr_view.go +++ b/completers/gh_completer/cmd/pr_view.go @@ -7,15 +7,16 @@ import ( ) var pr_viewCmd = &cobra.Command{ - Use: "view [ | | ]", + Use: "view", Short: "View a pull request", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(pr_viewCmd).Standalone() pr_viewCmd.Flags().BoolP("comments", "c", false, "View pull request comments") pr_viewCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - pr_viewCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + pr_viewCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") pr_viewCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") pr_viewCmd.Flags().BoolP("web", "w", false, "Open a pull request in the browser") prCmd.AddCommand(pr_viewCmd) diff --git a/completers/gh_completer/cmd/release.go b/completers/gh_completer/cmd/release.go index 786c6b7386..2ec17595f4 100644 --- a/completers/gh_completer/cmd/release.go +++ b/completers/gh_completer/cmd/release.go @@ -7,12 +7,13 @@ import ( ) var releaseCmd = &cobra.Command{ - Use: "release ", + Use: "release", Short: "Manage GitHub releases", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(releaseCmd).Standalone() releaseCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") rootCmd.AddCommand(releaseCmd) diff --git a/completers/gh_completer/cmd/release_create.go b/completers/gh_completer/cmd/release_create.go index d0708808ac..6d77134bd1 100644 --- a/completers/gh_completer/cmd/release_create.go +++ b/completers/gh_completer/cmd/release_create.go @@ -7,16 +7,17 @@ import ( ) var release_createCmd = &cobra.Command{ - Use: "create [...]", + Use: "create", Short: "Create a new release", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(release_createCmd).Standalone() release_createCmd.Flags().String("discussion-category", "", "Start a discussion of the specified category") release_createCmd.Flags().BoolP("draft", "d", false, "Save the release as a draft instead of publishing it") release_createCmd.Flags().StringP("notes", "n", "", "Release notes") - release_createCmd.Flags().StringP("notes-file", "F", "", "Read release notes from `file`") + release_createCmd.Flags().StringP("notes-file", "F", "", "Read release notes from `file` (use \"-\" to read from standard input)") 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)") release_createCmd.Flags().StringP("title", "t", "", "Release title") diff --git a/completers/gh_completer/cmd/release_delete.go b/completers/gh_completer/cmd/release_delete.go index cf93e58ac2..fde37c65be 100644 --- a/completers/gh_completer/cmd/release_delete.go +++ b/completers/gh_completer/cmd/release_delete.go @@ -7,12 +7,13 @@ import ( ) var release_deleteCmd = &cobra.Command{ - Use: "delete ", + Use: "delete", Short: "Delete a release", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(release_deleteCmd).Standalone() release_deleteCmd.Flags().BoolP("yes", "y", false, "Skip the confirmation prompt") releaseCmd.AddCommand(release_deleteCmd) diff --git a/completers/gh_completer/cmd/release_download.go b/completers/gh_completer/cmd/release_download.go index c04c2f9983..c9a77cebe3 100644 --- a/completers/gh_completer/cmd/release_download.go +++ b/completers/gh_completer/cmd/release_download.go @@ -7,18 +7,21 @@ import ( ) var release_downloadCmd = &cobra.Command{ - Use: "download []", + Use: "download", Short: "Download release assets", Run: func(cmd *cobra.Command, args []string) {}, } 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().StringP("dir", "D", ".", "The directory to download files into") - release_downloadCmd.Flags().StringArrayP("pattern", "p", nil, "Download only assets that match a glob pattern") + release_downloadCmd.Flags().StringArrayP("pattern", "p", []string{}, "Download only assets that match a glob pattern") releaseCmd.AddCommand(release_downloadCmd) carapace.Gen(release_downloadCmd).FlagCompletion(carapace.ActionMap{ - "dir": carapace.ActionDirectories(), + "archive": carapace.ActionValues("zip", "tar.gz"), + "dir": carapace.ActionDirectories(), "pattern": carapace.ActionCallback(func(c carapace.Context) carapace.Action { if len(c.Args) > 0 { return action.ActionReleaseAssets(release_downloadCmd, c.Args[0]) diff --git a/completers/gh_completer/cmd/release_list.go b/completers/gh_completer/cmd/release_list.go index 3d891c6eb4..ddaf67cdfa 100644 --- a/completers/gh_completer/cmd/release_list.go +++ b/completers/gh_completer/cmd/release_list.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,6 +12,7 @@ var release_listCmd = &cobra.Command{ } func init() { + carapace.Gen(release_listCmd).Standalone() release_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of items to fetch") releaseCmd.AddCommand(release_listCmd) } diff --git a/completers/gh_completer/cmd/release_upload.go b/completers/gh_completer/cmd/release_upload.go index 87132e42e9..82f7e5c5f4 100644 --- a/completers/gh_completer/cmd/release_upload.go +++ b/completers/gh_completer/cmd/release_upload.go @@ -7,12 +7,13 @@ import ( ) var release_uploadCmd = &cobra.Command{ - Use: "upload ...", + Use: "upload", Short: "Upload assets to a release", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(release_uploadCmd).Standalone() release_uploadCmd.Flags().Bool("clobber", false, "Overwrite existing assets of the same name") releaseCmd.AddCommand(release_uploadCmd) diff --git a/completers/gh_completer/cmd/release_view.go b/completers/gh_completer/cmd/release_view.go index 21ea35f25e..e53e20d561 100644 --- a/completers/gh_completer/cmd/release_view.go +++ b/completers/gh_completer/cmd/release_view.go @@ -7,14 +7,15 @@ import ( ) var release_viewCmd = &cobra.Command{ - Use: "view []", + Use: "view", Short: "View information about a release", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(release_viewCmd).Standalone() release_viewCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - release_viewCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + release_viewCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") release_viewCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") release_viewCmd.Flags().BoolP("web", "w", false, "Open the release in the browser") releaseCmd.AddCommand(release_viewCmd) diff --git a/completers/gh_completer/cmd/repo.go b/completers/gh_completer/cmd/repo.go index 910965a3a6..214f2f7ce5 100644 --- a/completers/gh_completer/cmd/repo.go +++ b/completers/gh_completer/cmd/repo.go @@ -1,15 +1,17 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) var repoCmd = &cobra.Command{ - Use: "repo ", + Use: "repo", Short: "Create, clone, fork, and view repositories", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(repoCmd).Standalone() rootCmd.AddCommand(repoCmd) } diff --git a/completers/gh_completer/cmd/repo_archive.go b/completers/gh_completer/cmd/repo_archive.go index 0b32decca0..5ecf2feb6d 100644 --- a/completers/gh_completer/cmd/repo_archive.go +++ b/completers/gh_completer/cmd/repo_archive.go @@ -8,11 +8,13 @@ import ( var repo_archiveCmd = &cobra.Command{ Use: "archive", - Short: "Archive a GitHub repository.", + Short: "Archive a repository", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(repo_archiveCmd).Standalone() + repo_archiveCmd.Flags().BoolP("confirm", "y", false, "Skip the confirmation prompt") repoCmd.AddCommand(repo_archiveCmd) carapace.Gen(repo_archiveCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/repo_clone.go b/completers/gh_completer/cmd/repo_clone.go index 82196d45a5..685a2fa4d2 100644 --- a/completers/gh_completer/cmd/repo_clone.go +++ b/completers/gh_completer/cmd/repo_clone.go @@ -7,12 +7,13 @@ import ( ) var repo_cloneCmd = &cobra.Command{ - Use: "clone [] [-- ...]", + Use: "clone", Short: "Clone a repository locally", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(repo_cloneCmd).Standalone() repoCmd.AddCommand(repo_cloneCmd) carapace.Gen(repo_cloneCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/repo_create.go b/completers/gh_completer/cmd/repo_create.go index a52ec6d0fe..36b50ae0ea 100644 --- a/completers/gh_completer/cmd/repo_create.go +++ b/completers/gh_completer/cmd/repo_create.go @@ -7,14 +7,18 @@ import ( ) var repo_createCmd = &cobra.Command{ - Use: "create []", + Use: "create", Short: "Create a new repository", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(repo_createCmd).Standalone() + repo_createCmd.Flags().BoolP("clone", "c", false, "Clone the new repository to the current directory") repo_createCmd.Flags().BoolP("confirm", "y", false, "Skip the confirmation prompt") repo_createCmd.Flags().StringP("description", "d", "", "Description of the repository") + repo_createCmd.Flags().Bool("disable-issues", false, "Disable issues in the new repository") + repo_createCmd.Flags().Bool("disable-wiki", false, "Disable wiki in the new repository") repo_createCmd.Flags().Bool("enable-issues", true, "Enable issues in the new repository") repo_createCmd.Flags().Bool("enable-wiki", true, "Enable wiki in the new repository") repo_createCmd.Flags().StringP("gitignore", "g", "", "Specify a gitignore template for the repository") @@ -23,6 +27,9 @@ func init() { repo_createCmd.Flags().StringP("license", "l", "", "Specify an Open Source License for the repository") repo_createCmd.Flags().Bool("private", false, "Make the new repository private") repo_createCmd.Flags().Bool("public", false, "Make the new repository public") + repo_createCmd.Flags().Bool("push", false, "Push local commits to the new repository") + repo_createCmd.Flags().StringP("remote", "r", "", "Specify remote name for the new repository") + repo_createCmd.Flags().StringP("source", "s", "", "Specify path to local repository to use as source") repo_createCmd.Flags().StringP("team", "t", "", "The `name` of the organization team to be granted access") repo_createCmd.Flags().StringP("template", "p", "", "Make the new repository based on a template `repository`") repoCmd.AddCommand(repo_createCmd) @@ -30,6 +37,7 @@ func init() { carapace.Gen(repo_createCmd).FlagCompletion(carapace.ActionMap{ "gitignore": action.ActionGitignoreTemplates(repo_createCmd), "license": action.ActionLicenses(repo_createCmd), + "source": carapace.ActionDirectories(), // TODO team "template": action.ActionOwnerRepositories(repo_createCmd), }) diff --git a/completers/gh_completer/cmd/repo_delete.go b/completers/gh_completer/cmd/repo_delete.go index 08c902a1d3..8d4edda2cf 100644 --- a/completers/gh_completer/cmd/repo_delete.go +++ b/completers/gh_completer/cmd/repo_delete.go @@ -13,6 +13,7 @@ var repo_deleteCmd = &cobra.Command{ } func init() { + carapace.Gen(repo_deleteCmd).Standalone() repo_deleteCmd.Flags().Bool("confirm", false, "confirm deletion without prompting") repoCmd.AddCommand(repo_deleteCmd) diff --git a/completers/gh_completer/cmd/repo_fork.go b/completers/gh_completer/cmd/repo_fork.go index c3ee29fb65..10056873bc 100644 --- a/completers/gh_completer/cmd/repo_fork.go +++ b/completers/gh_completer/cmd/repo_fork.go @@ -7,12 +7,13 @@ import ( ) var repo_forkCmd = &cobra.Command{ - Use: "fork [] [-- ...]", + Use: "fork", Short: "Create a fork of a repository", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(repo_forkCmd).Standalone() repo_forkCmd.Flags().Bool("clone", false, "Clone the fork {true|false}") repo_forkCmd.Flags().String("org", "", "Create the fork in an organization") repo_forkCmd.Flags().Bool("remote", false, "Add remote for fork {true|false}") diff --git a/completers/gh_completer/cmd/repo_list.go b/completers/gh_completer/cmd/repo_list.go index f5258271eb..30aed37876 100644 --- a/completers/gh_completer/cmd/repo_list.go +++ b/completers/gh_completer/cmd/repo_list.go @@ -7,18 +7,19 @@ import ( ) var repo_listCmd = &cobra.Command{ - Use: "list []", + Use: "list", Short: "List repositories owned by user or organization", Run: func(cmd *cobra.Command, args []string) {}, } func init() { - repo_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of repositories to list") + carapace.Gen(repo_listCmd).Standalone() repo_listCmd.Flags().Bool("archived", false, "Show only archived repositories") repo_listCmd.Flags().Bool("fork", false, "Show only forks") repo_listCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - repo_listCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + repo_listCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") repo_listCmd.Flags().StringP("language", "l", "", "Filter by primary coding language") + repo_listCmd.Flags().IntP("limit", "L", 30, "Maximum number of repositories to list") repo_listCmd.Flags().Bool("no-archived", false, "Omit archived repositories") repo_listCmd.Flags().Bool("private", false, "Show only private repositories") repo_listCmd.Flags().Bool("public", false, "Show only public repositories") diff --git a/completers/gh_completer/cmd/repo_rename.go b/completers/gh_completer/cmd/repo_rename.go new file mode 100644 index 0000000000..ea9b64a7d6 --- /dev/null +++ b/completers/gh_completer/cmd/repo_rename.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/completers/gh_completer/cmd/action" + "github.com/spf13/cobra" +) + +var repo_renameCmd = &cobra.Command{ + Use: "rename", + Short: "Rename a repository", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(repo_renameCmd).Standalone() + repo_renameCmd.Flags().BoolP("confirm", "y", false, "skip confirmation prompt") + repo_renameCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") + repoCmd.AddCommand(repo_renameCmd) + + carapace.Gen(repo_renameCmd).FlagCompletion(carapace.ActionMap{ + "repo": action.ActionRepoOverride(repo_renameCmd), + }) +} diff --git a/completers/gh_completer/cmd/repo_sync.go b/completers/gh_completer/cmd/repo_sync.go index c02fc46ebf..daa6d1c684 100644 --- a/completers/gh_completer/cmd/repo_sync.go +++ b/completers/gh_completer/cmd/repo_sync.go @@ -13,6 +13,7 @@ var repo_syncCmd = &cobra.Command{ } func init() { + carapace.Gen(repo_syncCmd).Standalone() repo_syncCmd.Flags().StringP("branch", "b", "", "Branch to sync (default: main branch)") repo_syncCmd.Flags().Bool("force", false, "Hard reset the branch of the destination repository to match the source repository") repo_syncCmd.Flags().StringP("source", "s", "", "Source repository") diff --git a/completers/gh_completer/cmd/repo_view.go b/completers/gh_completer/cmd/repo_view.go index 95833afaf4..b4c3f34b21 100644 --- a/completers/gh_completer/cmd/repo_view.go +++ b/completers/gh_completer/cmd/repo_view.go @@ -7,15 +7,16 @@ import ( ) var repo_viewCmd = &cobra.Command{ - Use: "view []", + Use: "view", Short: "View a repository", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(repo_viewCmd).Standalone() repo_viewCmd.Flags().StringP("branch", "b", "", "View a specific branch of the repository") repo_viewCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - repo_viewCmd.Flags().StringSlice("json", nil, "Output JSON with the specified `fields`") + repo_viewCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`") repo_viewCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template") repo_viewCmd.Flags().BoolP("web", "w", false, "Open a repository in the browser") repoCmd.AddCommand(repo_viewCmd) diff --git a/completers/gh_completer/cmd/root.go b/completers/gh_completer/cmd/root.go index ae0b6607c0..b3fd8b994b 100644 --- a/completers/gh_completer/cmd/root.go +++ b/completers/gh_completer/cmd/root.go @@ -7,7 +7,7 @@ import ( ) var rootCmd = &cobra.Command{ - Use: "gh [flags]", + Use: "gh", Short: "GitHub CLI", Long: "https://cli.github.com/", Run: func(cmd *cobra.Command, args []string) {}, @@ -18,6 +18,7 @@ func Execute() error { } func init() { + carapace.Gen(rootCmd).Standalone() rootCmd.PersistentFlags().Bool("help", false, "Show help for command") rootCmd.Flags().Bool("version", false, "Show gh version") diff --git a/completers/gh_completer/cmd/run.go b/completers/gh_completer/cmd/run.go index 9d0ec4b003..5a41483a89 100644 --- a/completers/gh_completer/cmd/run.go +++ b/completers/gh_completer/cmd/run.go @@ -7,12 +7,13 @@ import ( ) var runCmd = &cobra.Command{ - Use: "run ", + Use: "run", Short: "View details about workflow runs", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(runCmd).Standalone() runCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") rootCmd.AddCommand(runCmd) diff --git a/completers/gh_completer/cmd/run_cancel.go b/completers/gh_completer/cmd/run_cancel.go index aa7861cbf2..11d5782c8e 100644 --- a/completers/gh_completer/cmd/run_cancel.go +++ b/completers/gh_completer/cmd/run_cancel.go @@ -13,6 +13,7 @@ var run_cancelCmd = &cobra.Command{ } func init() { + carapace.Gen(run_cancelCmd).Standalone() runCmd.AddCommand(run_cancelCmd) carapace.Gen(runCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/run_download.go b/completers/gh_completer/cmd/run_download.go index b046279f27..0357b8da9b 100644 --- a/completers/gh_completer/cmd/run_download.go +++ b/completers/gh_completer/cmd/run_download.go @@ -7,14 +7,15 @@ import ( ) var run_downloadCmd = &cobra.Command{ - Use: "download []", + Use: "download", Short: "Download artifacts generated by a workflow run", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(run_downloadCmd).Standalone() run_downloadCmd.Flags().StringP("dir", "D", ".", "The directory to download artifacts into") - run_downloadCmd.Flags().StringArrayP("name", "n", nil, "Only download artifacts that match any of the given names") + run_downloadCmd.Flags().StringArrayP("name", "n", []string{}, "Only download artifacts that match any of the given names") runCmd.AddCommand(run_downloadCmd) carapace.Gen(run_downloadCmd).FlagCompletion(carapace.ActionMap{ diff --git a/completers/gh_completer/cmd/run_list.go b/completers/gh_completer/cmd/run_list.go index d03e127853..9112f6437f 100644 --- a/completers/gh_completer/cmd/run_list.go +++ b/completers/gh_completer/cmd/run_list.go @@ -13,6 +13,7 @@ var run_listCmd = &cobra.Command{ } func init() { + carapace.Gen(run_listCmd).Standalone() run_listCmd.Flags().IntP("limit", "L", 20, "Maximum number of runs to fetch") run_listCmd.Flags().StringP("workflow", "w", "", "Filter runs by workflow") runCmd.AddCommand(run_listCmd) diff --git a/completers/gh_completer/cmd/run_rerun.go b/completers/gh_completer/cmd/run_rerun.go index eb55a9aad3..3568bdf003 100644 --- a/completers/gh_completer/cmd/run_rerun.go +++ b/completers/gh_completer/cmd/run_rerun.go @@ -7,12 +7,13 @@ import ( ) var run_rerunCmd = &cobra.Command{ - Use: "rerun []", + Use: "rerun", Short: "Rerun a failed run", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(run_rerunCmd).Standalone() runCmd.AddCommand(run_rerunCmd) carapace.Gen(run_rerunCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/run_view.go b/completers/gh_completer/cmd/run_view.go index 70fe4b2d97..7cfa34a7a3 100644 --- a/completers/gh_completer/cmd/run_view.go +++ b/completers/gh_completer/cmd/run_view.go @@ -7,12 +7,13 @@ import ( ) var run_viewCmd = &cobra.Command{ - Use: "view []", + Use: "view", Short: "View a summary of a workflow run", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(run_viewCmd).Standalone() run_viewCmd.Flags().Bool("exit-status", false, "Exit with non-zero status if run failed") run_viewCmd.Flags().StringP("job", "j", "", "View a specific job ID from a run") run_viewCmd.Flags().Bool("log", false, "View full log for either a run or specific job") diff --git a/completers/gh_completer/cmd/run_watch.go b/completers/gh_completer/cmd/run_watch.go index bfec210439..7f69f63993 100644 --- a/completers/gh_completer/cmd/run_watch.go +++ b/completers/gh_completer/cmd/run_watch.go @@ -7,12 +7,13 @@ import ( ) var run_watchCmd = &cobra.Command{ - Use: "watch ", + Use: "watch", Short: "Watch a run until it completes, showing its progress", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(run_watchCmd).Standalone() run_watchCmd.Flags().Bool("exit-status", false, "Exit with non-zero status if run fails") run_watchCmd.Flags().IntP("interval", "i", 3, "Refresh interval in seconds") runCmd.AddCommand(run_watchCmd) diff --git a/completers/gh_completer/cmd/secret.go b/completers/gh_completer/cmd/secret.go index b78161617f..85dcfe1a96 100644 --- a/completers/gh_completer/cmd/secret.go +++ b/completers/gh_completer/cmd/secret.go @@ -7,12 +7,13 @@ import ( ) var secretCmd = &cobra.Command{ - Use: "secret ", + Use: "secret", Short: "Manage GitHub secrets", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(secretCmd).Standalone() secretCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") rootCmd.AddCommand(secretCmd) diff --git a/completers/gh_completer/cmd/secret_list.go b/completers/gh_completer/cmd/secret_list.go index 96f261a00d..74a3d810e5 100644 --- a/completers/gh_completer/cmd/secret_list.go +++ b/completers/gh_completer/cmd/secret_list.go @@ -13,8 +13,10 @@ var secret_listCmd = &cobra.Command{ } func init() { + carapace.Gen(secret_listCmd).Standalone() secret_listCmd.Flags().StringP("env", "e", "", "List secrets for an environment") secret_listCmd.Flags().StringP("org", "o", "", "List secrets for an organization") + secret_listCmd.Flags().BoolP("user", "u", false, "List a secret for your user") secretCmd.AddCommand(secret_listCmd) carapace.Gen(secret_listCmd).FlagCompletion(carapace.ActionMap{ diff --git a/completers/gh_completer/cmd/secret_remove.go b/completers/gh_completer/cmd/secret_remove.go index 72ef1188fb..286928be37 100644 --- a/completers/gh_completer/cmd/secret_remove.go +++ b/completers/gh_completer/cmd/secret_remove.go @@ -7,14 +7,16 @@ import ( ) var secret_removeCmd = &cobra.Command{ - Use: "remove ", - Short: "Remove an organization or repository secret", + Use: "remove", + Short: "Remove secrets", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(secret_removeCmd).Standalone() secret_removeCmd.Flags().StringP("env", "e", "", "Remove a secret for an environment") - secret_removeCmd.Flags().StringP("org", "o", "", "List secrets for an organization") + secret_removeCmd.Flags().StringP("org", "o", "", "Remove a secret for an organization") + secret_removeCmd.Flags().BoolP("user", "u", false, "Remove a secret for your user") secretCmd.AddCommand(secret_removeCmd) carapace.Gen(secret_removeCmd).FlagCompletion(carapace.ActionMap{ diff --git a/completers/gh_completer/cmd/secret_set.go b/completers/gh_completer/cmd/secret_set.go index 7399f12eb4..dda36aaa21 100644 --- a/completers/gh_completer/cmd/secret_set.go +++ b/completers/gh_completer/cmd/secret_set.go @@ -7,17 +7,20 @@ import ( ) var secret_setCmd = &cobra.Command{ - Use: "set ", + Use: "set", Short: "Create or update secrets", Run: func(cmd *cobra.Command, args []string) {}, } func init() { - secret_setCmd.Flags().StringP("body", "b", "", "A value for the secret. Reads from STDIN if not specified.") - secret_setCmd.Flags().StringP("env", "e", "", "Set a secret for an organization") - secret_setCmd.Flags().StringP("org", "o", "", "List secrets for an organization") - secret_setCmd.Flags().StringSliceP("repos", "r", []string{}, "List of repository names for `selected` visibility") - secret_setCmd.Flags().StringP("visibility", "v", "private", "Set visibility for an organization secret: `all`, `private`, or `selected`") + carapace.Gen(secret_setCmd).Standalone() + secret_setCmd.Flags().StringP("body", "b", "", "The value for the secret (reads from standard input if not specified)") + secret_setCmd.Flags().StringP("env", "e", "", "Set deployment `environment` secret") + secret_setCmd.Flags().Bool("no-store", false, "Print the encrypted, base64-encoded value instead of storing it on Github") + secret_setCmd.Flags().StringP("org", "o", "", "Set `organization` secret") + secret_setCmd.Flags().StringSliceP("repos", "r", []string{}, "List of `repositories` that can access an organization or user secret") + secret_setCmd.Flags().BoolP("user", "u", false, "Set a secret for your user") + secret_setCmd.Flags().StringP("visibility", "v", "private", "Set visibility for an organization secret: `{all|private|selected}`") secretCmd.AddCommand(secret_setCmd) carapace.Gen(secret_setCmd).FlagCompletion(carapace.ActionMap{ diff --git a/completers/gh_completer/cmd/sshKey.go b/completers/gh_completer/cmd/sshKey.go index c826dc88d8..085af497e6 100644 --- a/completers/gh_completer/cmd/sshKey.go +++ b/completers/gh_completer/cmd/sshKey.go @@ -1,15 +1,17 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) var sshKeyCmd = &cobra.Command{ - Use: "ssh-key ", + Use: "ssh-key", Short: "Manage SSH keys", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(sshKeyCmd).Standalone() rootCmd.AddCommand(sshKeyCmd) } diff --git a/completers/gh_completer/cmd/sshKey_add.go b/completers/gh_completer/cmd/sshKey_add.go index bfd8badd3e..6717e2523a 100644 --- a/completers/gh_completer/cmd/sshKey_add.go +++ b/completers/gh_completer/cmd/sshKey_add.go @@ -6,12 +6,13 @@ import ( ) var sshKey_addCmd = &cobra.Command{ - Use: "add []", + Use: "add", Short: "Add an SSH key to your GitHub account", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(sshKey_addCmd).Standalone() sshKey_addCmd.Flags().StringP("title", "t", "", "Title for the new key") sshKeyCmd.AddCommand(sshKey_addCmd) diff --git a/completers/gh_completer/cmd/sshKey_list.go b/completers/gh_completer/cmd/sshKey_list.go index 94ee19a39c..b934d1d4d7 100644 --- a/completers/gh_completer/cmd/sshKey_list.go +++ b/completers/gh_completer/cmd/sshKey_list.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,5 +12,6 @@ var sshKey_listCmd = &cobra.Command{ } func init() { + carapace.Gen(sshKey_listCmd).Standalone() sshKeyCmd.AddCommand(sshKey_listCmd) } diff --git a/completers/gh_completer/cmd/workflow.go b/completers/gh_completer/cmd/workflow.go index d129a5ed57..96c37ab077 100644 --- a/completers/gh_completer/cmd/workflow.go +++ b/completers/gh_completer/cmd/workflow.go @@ -7,12 +7,13 @@ import ( ) var workflowCmd = &cobra.Command{ - Use: "workflow ", + Use: "workflow", Short: "View details about GitHub Actions workflows", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(workflowCmd).Standalone() workflowCmd.PersistentFlags().StringP("repo", "R", "", "Select another repository using the `[HOST/]OWNER/REPO` format") rootCmd.AddCommand(workflowCmd) diff --git a/completers/gh_completer/cmd/workflow_disable.go b/completers/gh_completer/cmd/workflow_disable.go index 232d574aee..33fa515628 100644 --- a/completers/gh_completer/cmd/workflow_disable.go +++ b/completers/gh_completer/cmd/workflow_disable.go @@ -7,12 +7,13 @@ import ( ) var workflow_disableCmd = &cobra.Command{ - Use: "disable [ | ]", + Use: "disable", Short: "Disable a workflow", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(workflow_disableCmd).Standalone() workflowCmd.AddCommand(workflow_disableCmd) carapace.Gen(workflow_disableCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/workflow_enable.go b/completers/gh_completer/cmd/workflow_enable.go index 1919d5637b..46c603af42 100644 --- a/completers/gh_completer/cmd/workflow_enable.go +++ b/completers/gh_completer/cmd/workflow_enable.go @@ -7,12 +7,13 @@ import ( ) var workflow_enableCmd = &cobra.Command{ - Use: "enable [ | ]", + Use: "enable", Short: "Enable a workflow", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(workflow_enableCmd).Standalone() workflowCmd.AddCommand(workflow_enableCmd) carapace.Gen(workflow_enableCmd).PositionalCompletion( diff --git a/completers/gh_completer/cmd/workflow_list.go b/completers/gh_completer/cmd/workflow_list.go index 98294d80d7..f6a8d239f4 100644 --- a/completers/gh_completer/cmd/workflow_list.go +++ b/completers/gh_completer/cmd/workflow_list.go @@ -1,6 +1,7 @@ package cmd import ( + "github.com/rsteube/carapace" "github.com/spf13/cobra" ) @@ -11,6 +12,9 @@ var workflow_listCmd = &cobra.Command{ } func init() { + carapace.Gen(workflow_listCmd).Standalone() + workflow_listCmd.Flags().BoolP("all", "a", false, "Show all workflows, including disabled workflows") + workflow_listCmd.Flags().IntP("limit", "L", 50, "Maximum number of workflows to fetch") workflowCmd.AddCommand(workflow_listCmd) workflowCmd.Flags().IntP("limit", "L", 50, "Maximum number of workflows to fetch") diff --git a/completers/gh_completer/cmd/workflow_run.go b/completers/gh_completer/cmd/workflow_run.go index 6465aae0e4..cbde94134a 100644 --- a/completers/gh_completer/cmd/workflow_run.go +++ b/completers/gh_completer/cmd/workflow_run.go @@ -7,15 +7,16 @@ import ( ) var workflow_runCmd = &cobra.Command{ - Use: "run [ | ]", + Use: "run", Short: "Run a workflow by creating a workflow_dispatch event", Run: func(cmd *cobra.Command, args []string) {}, } func init() { - workflow_runCmd.Flags().StringArrayP("field", "F", nil, "Add a string parameter in `key=value` format, respecting @ syntax") + carapace.Gen(workflow_runCmd).Standalone() + workflow_runCmd.Flags().StringArrayP("field", "F", []string{}, "Add a string parameter in `key=value` format, respecting @ syntax") workflow_runCmd.Flags().Bool("json", false, "Read workflow inputs as JSON via STDIN") - workflow_runCmd.Flags().StringArrayP("raw-field", "f", nil, "Add a string parameter in `key=value` format") + workflow_runCmd.Flags().StringArrayP("raw-field", "f", []string{}, "Add a string parameter in `key=value` format") workflow_runCmd.Flags().StringP("ref", "r", "", "The branch or tag name which contains the version of the workflow file you'd like to run") workflowCmd.AddCommand(workflow_runCmd) diff --git a/completers/gh_completer/cmd/workflow_view.go b/completers/gh_completer/cmd/workflow_view.go index b13ad2443f..69b45c165a 100644 --- a/completers/gh_completer/cmd/workflow_view.go +++ b/completers/gh_completer/cmd/workflow_view.go @@ -7,12 +7,13 @@ import ( ) var workflow_viewCmd = &cobra.Command{ - Use: "view [ | | ]", + Use: "view", Short: "View the summary of a workflow", Run: func(cmd *cobra.Command, args []string) {}, } func init() { + carapace.Gen(workflow_viewCmd).Standalone() workflow_viewCmd.Flags().StringP("ref", "r", "", "The branch or tag name which contains the version of the workflow file you'd like to view") workflow_viewCmd.Flags().BoolP("web", "w", false, "Open workflow in the browser") workflow_viewCmd.Flags().BoolP("yaml", "y", false, "View the workflow yaml file")