Repository: cli/cli
Pull request #10430 (2025-02-13 06:08:59)

Remove trailing whitespace
- Remove trailing whitespace
  - Regex to search trailing whitespace: `\s+$`


Patch:
diff --git a/pkg/cmd/actions/actions.go b/pkg/cmd/actions/actions.go
index 663866844..76d72b954 100644
--- a/pkg/cmd/actions/actions.go
+++ b/pkg/cmd/actions/actions.go
@@ -34,19 +34,19 @@ func actionsExplainer(cs *iostreams.ColorScheme) string {
 			GitHub CLI integrates with GitHub Actions to help you manage runs and workflows.
 
 			%[3]s
-			gh run list:      List recent workflow runs  
-			gh run view:      View details for a workflow run or one of its jobs  
-			gh run watch:     Watch a workflow run while it executes  
-			gh run rerun:     Rerun a failed workflow run  
+			gh run list:      List recent workflow runs
+			gh run view:      View details for a workflow run or one of its jobs
+			gh run watch:     Watch a workflow run while it executes
+			gh run rerun:     Rerun a failed workflow run
 			gh run download:  Download artifacts generated by runs
 
 			To see more help, run %[1]sgh help run <subcommand>%[1]s
 
 			%[4]s
 			gh workflow list:     List workflow files in your repository
-			gh workflow view:     View details for a workflow file  
-			gh workflow enable:   Enable a workflow file  
-			gh workflow disable:  Disable a workflow file  
+			gh workflow view:     View details for a workflow file
+			gh workflow enable:   Enable a workflow file
+			gh workflow disable:  Disable a workflow file
 			gh workflow run:      Trigger a workflow_dispatch run for a workflow file
 
 			To see more help, run %[1]sgh help workflow <subcommand>%[1]s
diff --git a/pkg/cmd/auth/login/login.go b/pkg/cmd/auth/login/login.go
index 347fcdb6a..95e32b799 100644
--- a/pkg/cmd/auth/login/login.go
+++ b/pkg/cmd/auth/login/login.go
@@ -72,7 +72,7 @@ func NewCmdLogin(f *cmdutil.Factory, runF func(*LoginOptions) error) *cobra.Comm
 			The minimum required scopes for the token are: %[1]srepo%[1]s, %[1]sread:org%[1]s, and %[1]sgist%[1]s.
 			Take care when passing a fine-grained personal access token to %[1]s--with-token%[1]s
 			as the inherent scoping to certain resources may cause confusing behaviour when interacting with other
-			resources. Favour setting %[1]sGH_TOKEN$%[1]s for fine-grained personal access token usage. 
+			resources. Favour setting %[1]sGH_TOKEN$%[1]s for fine-grained personal access token usage.
 
 			Alternatively, gh will use the authentication token found in environment variables.
 			This method is most suitable for "headless" use of gh such as in automation. See
diff --git a/pkg/cmd/codespace/rebuild.go b/pkg/cmd/codespace/rebuild.go
index 565406edc..8566c2211 100644
--- a/pkg/cmd/codespace/rebuild.go
+++ b/pkg/cmd/codespace/rebuild.go
@@ -23,7 +23,7 @@ func newRebuildCmd(app *App) *cobra.Command {
 		Short: "Rebuild a codespace",
 		Long: heredoc.Doc(`
 			Rebuilding recreates your codespace.
-			
+
 			Your code and any current changes will be preserved. Your codespace will be rebuilt using
 			your working directory's dev container. A full rebuild also removes cached Docker images.
 		`),
diff --git a/pkg/cmd/codespace/ssh.go b/pkg/cmd/codespace/ssh.go
index b79ec68c9..70e7ceb42 100644
--- a/pkg/cmd/codespace/ssh.go
+++ b/pkg/cmd/codespace/ssh.go
@@ -55,7 +55,7 @@ func newSSHCmd(app *App) *cobra.Command {
 		Long: heredoc.Docf(`
 			The %[1]sssh%[1]s command is used to SSH into a codespace. In its simplest form, you can
 			run %[1]sgh cs ssh%[1]s, select a codespace interactively, and connect.
-			
+
 			The %[1]sssh%[1]s command will automatically create a public/private ssh key pair in the
 			%[1]s~/.ssh%[1]s directory if you do not have an existing valid key pair. When selecting the
 			key pair to use, the preferred order is:
@@ -732,8 +732,8 @@ func newCpCmd(app *App) *cobra.Command {
 			be evaluated on the remote machine, subject to expansion of tildes, braces, globs,
 			environment variables, and backticks. For security, do not use this flag with arguments
 			provided by untrusted users; see <https://lwn.net/Articles/835962/> for discussion.
-			
-			By default, the %[1]scp%[1]s command will create a public/private ssh key pair to authenticate with 
+
+			By default, the %[1]scp%[1]s command will create a public/private ssh key pair to authenticate with
 			the codespace inside the %[1]s~/.ssh directory%[1]s.
 		`, "`"),
 		Example: heredoc.Doc(`
diff --git a/pkg/cmd/codespace/view.go b/pkg/cmd/codespace/view.go
index e212f0820..205d54673 100644
--- a/pkg/cmd/codespace/view.go
+++ b/pkg/cmd/codespace/view.go
@@ -30,7 +30,7 @@ func newViewCmd(app *App) *cobra.Command {
 		Short: "View details about a codespace",
 		Example: heredoc.Doc(`
 			# select a codespace from a list of all codespaces you own
-			$ gh cs view	
+			$ gh cs view
 
 			# view the details of a specific codespace
 			$ gh cs view -c codespace-name-12345
diff --git a/pkg/cmd/completion/completion.go b/pkg/cmd/completion/completion.go
index d83dd31ef..b34bf7abf 100644
--- a/pkg/cmd/completion/completion.go
+++ b/pkg/cmd/completion/completion.go
@@ -33,7 +33,7 @@ func NewCmdCompletion(io *iostreams.IOStreams) *cobra.Command {
 			After, add this to your %[1]s~/.bash_profile%[1]s:
 
 				eval "$(gh completion -s bash)"
-			
+
 			### zsh
 
 			Generate a %[1]s_gh%[1]s completion script and put it somewhere in your %[1]s$fpath%[1]s:
@@ -44,7 +44,7 @@ func NewCmdCompletion(io *iostreams.IOStreams) *cobra.Command {
 
 				autoload -U compinit
 				compinit -i
-			
+
 			Zsh version 5.7 or later is recommended.
 
 			### fish
@@ -59,7 +59,7 @@ func NewCmdCompletion(io *iostreams.IOStreams) *cobra.Command {
 
 				mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
 				notepad $profile
-			
+
 			Add the line and save the file:
 
 				Invoke-Expression -Command $(gh completion -s powershell | Out-String)
diff --git a/pkg/cmd/pr/close/close.go b/pkg/cmd/pr/close/close.go
index ec5132377..063501ef7 100644
--- a/pkg/cmd/pr/close/close.go
+++ b/pkg/cmd/pr/close/close.go
@@ -143,7 +143,7 @@ func closeRun(opts *CloseOptions) error {
 					branchSwitchString = fmt.Sprintf(" and switched to branch %s", cs.Cyan(branchToSwitchTo))
 				}
 			} else {
-				fmt.Fprintf(opts.IO.ErrOut, "%s Skipped deleting the local branch since current directory is not a git repository \n", cs.WarningIcon())
+				fmt.Fprintf(opts.IO.ErrOut, "%s Skipped deleting the local branch since current directory is not a git repository\n", cs.WarningIcon())
 			}
 		}
 
diff --git a/pkg/cmd/project/item-edit/item_edit.go b/pkg/cmd/project/item-edit/item_edit.go
index 657af1f54..c4acaaea9 100644
--- a/pkg/cmd/project/item-edit/item_edit.go
+++ b/pkg/cmd/project/item-edit/item_edit.go
@@ -63,7 +63,7 @@ func NewCmdEditItem(f *cmdutil.Factory, runF func(config editItemConfig) error)
 		Short: "Edit an item in a project",
 		Long: heredoc.Docf(`
 			Edit either a draft issue or a project item. Both usages require the ID of the item to edit.
-			
+
 			For non-draft issues, the ID of the project is also required, and only a single field value can be updated per invocation.
 
 			Remove project item field value using %[1]s--clear%[1]s flag.
diff --git a/pkg/cmd/release/create/create.go b/pkg/cmd/release/create/create.go
index 8e77546d0..6da461a88 100644
--- a/pkg/cmd/release/create/create.go
+++ b/pkg/cmd/release/create/create.go
@@ -120,7 +120,7 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
 			$ gh release create v1.2.3 --notes-from-tag
 
 			Don't mark the release as latest
-			$ gh release create v1.2.3 --latest=false 
+			$ gh release create v1.2.3 --latest=false
 
 			Upload all tarballs in a directory as release assets
 			$ gh release create v1.2.3 ./dist/*.tgz
diff --git a/pkg/cmd/repo/delete/delete.go b/pkg/cmd/repo/delete/delete.go
index 7c6476f1d..50df0ddac 100644
--- a/pkg/cmd/repo/delete/delete.go
+++ b/pkg/cmd/repo/delete/delete.go
@@ -41,10 +41,10 @@ func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Co
 		Short: "Delete a repository",
 		Long: heredoc.Docf(`
 			Delete a GitHub repository.
-			
+
 			With no argument, deletes the current repository. Otherwise, deletes the specified repository.
 
-			Deletion requires authorization with the %[1]sdelete_repo%[1]s scope. 
+			Deletion requires authorization with the %[1]sdelete_repo%[1]s scope.
 			To authorize, run %[1]sgh auth refresh -s delete_repo%[1]s
 		`, "`"),
 		Args: cobra.MaximumNArgs(1),
diff --git a/pkg/cmd/repo/deploy-key/add/add.go b/pkg/cmd/repo/deploy-key/add/add.go
index 473d42498..dbac7dcfb 100644
--- a/pkg/cmd/repo/deploy-key/add/add.go
+++ b/pkg/cmd/repo/deploy-key/add/add.go
@@ -34,7 +34,7 @@ func NewCmdAdd(f *cmdutil.Factory, runF func(*AddOptions) error) *cobra.Command
 		Short: "Add a deploy key to a GitHub repository",
 		Long: heredoc.Doc(`
 			Add a deploy key to a GitHub repository.
-			
+
 			Note that any key added by gh will be associated with the current authentication token.
 			If you de-authorize the GitHub CLI app or authentication token from your account, any
 			deploy keys added by GitHub CLI will be removed as well.
diff --git a/pkg/cmd/repo/gitignore/view/view.go b/pkg/cmd/repo/gitignore/view/view.go
index 46e674632..b22f94ed9 100644
--- a/pkg/cmd/repo/gitignore/view/view.go
+++ b/pkg/cmd/repo/gitignore/view/view.go
@@ -34,7 +34,7 @@ func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Comman
 		Short: "View an available repository gitignore template",
 		Long: heredoc.Docf(`
 			View an available repository %[1]s.gitignore%[1]s template.
-			
+
 			%[1]s<template>%[1]s is a case-sensitive %[1]s.gitignore%[1]s template name.
 
 			For a list of available templates, run %[1]sgh repo gitignore list%[1]s.
diff --git a/pkg/cmd/repo/license/list/list.go b/pkg/cmd/repo/license/list/list.go
index 6431f58c0..ec003ad21 100644
--- a/pkg/cmd/repo/license/list/list.go
+++ b/pkg/cmd/repo/license/list/list.go
@@ -31,7 +31,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
 		Short: "List common repository licenses",
 		Long: heredoc.Doc(`
 			List common repository licenses.
-			
+
 			For even more licenses, visit <https://choosealicense.com/appendix>
 		`),
 		Aliases: []string{"ls"},
diff --git a/pkg/cmd/repo/rename/rename.go b/pkg/cmd/repo/rename/rename.go
index e50095d76..52a936b0e 100644
--- a/pkg/cmd/repo/rename/rename.go
+++ b/pkg/cmd/repo/rename/rename.go
@@ -52,12 +52,12 @@ func NewCmdRename(f *cmdutil.Factory, runf func(*RenameOptions) error) *cobra.Co
 		Short: "Rename a repository",
 		Long: heredoc.Docf(`
 			Rename a GitHub repository.
-			
+
 			%[1]s<new-name>%[1]s is the desired repository name without the owner.
-			
+
 			By default, the current repository is renamed. Otherwise, the repository specified
 			with %[1]s--repo%[1]s is renamed.
-			
+
 			To transfer repository ownership to another user account or organization,
 			you must follow additional steps on GitHub.com
 
diff --git a/pkg/cmd/ruleset/list/list.go b/pkg/cmd/ruleset/list/list.go
index 2b945c906..8c79b5d96 100644
--- a/pkg/cmd/ruleset/list/list.go
+++ b/pkg/cmd/ruleset/list/list.go
@@ -49,7 +49,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
 
 			Use the %[1]s--parents%[1]s flag to control whether rulesets configured at higher levels that also apply to the provided
 			repository or organization should be returned. The default is %[1]strue%[1]s.
-			
+
 			Your access token must have the %[1]sadmin:org%[1]s scope to use the %[1]s--org%[1]s flag, which can be granted by running %[1]sgh auth refresh -s admin:org%[1]s.
 		`, "`"),
 		Example: heredoc.Doc(`
diff --git a/pkg/cmd/ruleset/view/view.go b/pkg/cmd/ruleset/view/view.go
index cefd926ab..b535a1033 100644
--- a/pkg/cmd/ruleset/view/view.go
+++ b/pkg/cmd/ruleset/view/view.go
@@ -49,7 +49,7 @@ func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Comman
 
 			If no ID is provided, an interactive prompt will be used to choose
 			the ruleset to view.
-			
+
 			Use the %[1]s--parents%[1]s flag to control whether rulesets configured at higher
 			levels that also apply to the provided repository or organization should
 			be returned. The default is %[1]strue%[1]s.
diff --git a/pkg/cmd/run/rerun/rerun.go b/pkg/cmd/run/rerun/rerun.go
index 20e94b68f..66d5d6f64 100644
--- a/pkg/cmd/run/rerun/rerun.go
+++ b/pkg/cmd/run/rerun/rerun.go
@@ -50,7 +50,7 @@ func NewCmdRerun(f *cmdutil.Factory, runF func(*RerunOptions) error) *cobra.Comm
 
 			However, this %[1]s<number>%[1]s should not be used with the %[1]s--job%[1]s flag and will result in the
 			API returning %[1]s404 NOT FOUND%[1]s. Instead, you can get the correct job IDs using the following command:
-			
+
 				gh run view <run-id> --json jobs --jq '.jobs[] | {name, databaseId}'
 
 			You will need to use databaseId field for triggering job re-runs.
diff --git a/pkg/cmd/search/code/code.go b/pkg/cmd/search/code/code.go
index 761d2602c..6ba28f797 100644
--- a/pkg/cmd/search/code/code.go
+++ b/pkg/cmd/search/code/code.go
@@ -47,9 +47,9 @@ func NewCmdCode(f *cmdutil.Factory, runF func(*CodeOptions) error) *cobra.Comman
 			# search code matching "react" and "lifecycle"
 			$ gh search code react lifecycle
 
-			# search code matching "error handling" 
+			# search code matching "error handling"
 			$ gh search code "error handling"
-	
+
 			# search code matching "deque" in Python files
 			$ gh search code deque --language=python
 


Test patch:
diff --git a/pkg/cmd/gist/list/list_test.go b/pkg/cmd/gist/list/list_test.go
index e6cb35d53..0acfae109 100644
--- a/pkg/cmd/gist/list/list_test.go
+++ b/pkg/cmd/gist/list/list_test.go
@@ -540,14 +540,14 @@ func Test_listRun(t *testing.T) {
 			wantOut: heredoc.Doc(`
 				1234 main.txt
 				    octo match in the description
-				
+
 				2345 octo.txt
 				    match in the file name
 
 				3456 main.txt
 				    match in the file text
 				        octo in the text
-				
+
 			`),
 		},
 		{
@@ -599,14 +599,14 @@ func Test_listRun(t *testing.T) {
 			wantOut: heredoc.Docf(`
 				%[1]s[0;34m1234%[1]s[0m %[1]s[0;32mmain.txt%[1]s[0m
 				    %[1]s[0;30;43mocto%[1]s[0m%[1]s[0;1;39m match in the description%[1]s[0m
-				
+
 				%[1]s[0;34m2345%[1]s[0m %[1]s[0;30;43mocto%[1]s[0m%[1]s[0;32m.txt%[1]s[0m
 				    %[1]s[0;1;39mmatch in the file name%[1]s[0m
-				
+
 				%[1]s[0;34m3456%[1]s[0m %[1]s[0;32mmain.txt%[1]s[0m
 				    %[1]s[0;1;39mmatch in the file text%[1]s[0m
 				        %[1]s[0;30;43mocto%[1]s[0m in the text
-				
+
 			`, "\x1b"),
 		},
 	}
diff --git a/pkg/cmd/label/list_test.go b/pkg/cmd/label/list_test.go
index 6f066da32..8a1bc7c7a 100644
--- a/pkg/cmd/label/list_test.go
+++ b/pkg/cmd/label/list_test.go
@@ -218,7 +218,7 @@ func TestListRun(t *testing.T) {
 			wantStdout: heredoc.Doc(`
 
 				Showing 2 of 2 labels in OWNER/REPO
-				
+
 				NAME  DESCRIPTION           COLOR
 				bug   This is a bug label   #d73a4a
 				docs  This is a docs label  #ffa8da
diff --git a/pkg/cmd/pr/close/close_test.go b/pkg/cmd/pr/close/close_test.go
index f957581f8..959af0e04 100644
--- a/pkg/cmd/pr/close/close_test.go
+++ b/pkg/cmd/pr/close/close_test.go
@@ -271,7 +271,7 @@ func TestPrClose_deleteBranch_notInGitRepo(t *testing.T) {
 	assert.Equal(t, "", output.String())
 	assert.Equal(t, heredoc.Doc(`
 		✓ Closed pull request OWNER/REPO#96 (The title of the PR)
-		! Skipped deleting the local branch since current directory is not a git repository 
+		! Skipped deleting the local branch since current directory is not a git repository
 		✓ Deleted branch trunk
 	`), output.Stderr())
 }
diff --git a/pkg/cmd/release/view/view_test.go b/pkg/cmd/release/view/view_test.go
index 6fc747f69..1fed0fdc8 100644
--- a/pkg/cmd/release/view/view_test.go
+++ b/pkg/cmd/release/view/view_test.go
@@ -144,15 +144,15 @@ func Test_viewRun(t *testing.T) {
 			wantStdout: heredoc.Doc(`
 				v1.2.3
 				MonaLisa released this about 1 day ago
-				
+
 				                                                                                  
 				  • Fixed bugs                                                                    
-				
-				
+
+
 				Assets
 				windows.zip  12 B
 				linux.tgz    34 B
-				
+
 				View on GitHub: https://github.com/OWNER/REPO/releases/tags/v1.2.3
 			`),
 			wantStderr: ``,
@@ -168,15 +168,15 @@ func Test_viewRun(t *testing.T) {
 			wantStdout: heredoc.Doc(`
 				v1.2.3
 				MonaLisa released this about 1 day ago
-				
+
 				                                                                                  
 				  • Fixed bugs                                                                    
-				
-				
+
+
 				Assets
 				windows.zip  12 B
 				linux.tgz    34 B
-				
+
 				View on GitHub: https://github.com/OWNER/REPO/releases/tags/v1.2.3
 			`),
 			wantStderr: ``,
diff --git a/pkg/cmd/repo/license/view/view_test.go b/pkg/cmd/repo/license/view/view_test.go
index 40439d1f0..0a282693d 100644
--- a/pkg/cmd/repo/license/view/view_test.go
+++ b/pkg/cmd/repo/license/view/view_test.go
@@ -220,7 +220,7 @@ func TestViewRun(t *testing.T) {
 			wantErr: true,
 			errMsg: heredoc.Docf(`
 				'404' is not a valid license name or SPDX ID.
-				
+
 				Run %[1]sgh repo license list%[1]s to see available commonly used licenses. For even more licenses, visit https://choosealicense.com/appendix`, "`"),
 			httpStubs: func(reg *httpmock.Registry) {
 				reg.Register(
diff --git a/pkg/cmd/ruleset/view/view_test.go b/pkg/cmd/ruleset/view/view_test.go
index e463a9ac4..9aa4b1c00 100644
--- a/pkg/cmd/ruleset/view/view_test.go
+++ b/pkg/cmd/ruleset/view/view_test.go
@@ -158,14 +158,14 @@ func Test_viewRun(t *testing.T) {
 	Source: my-owner/repo-name (Repository)
 	Enforcement: Active
 	You can bypass: pull requests only
-	
+
 	Bypass List
 	- OrganizationAdmin (ID: 1), mode: always
 	- RepositoryRole (ID: 5), mode: always
-	
+
 	Conditions
 	- ref_name: [exclude: []] [include: [~ALL]] 
-	
+
 	Rules
 	- commit_author_email_pattern: [name: ] [negate: false] [operator: ends_with] [pattern: @example.com] 
 	- commit_message_pattern: [name: ] [negate: false] [operator: contains] [pattern: asdf] 
@@ -212,14 +212,14 @@ func Test_viewRun(t *testing.T) {
 			ID: 74
 			Source: my-owner (Organization)
 			Enforcement: Evaluate Mode (not enforced)
-			
+
 			Bypass List
 			This ruleset cannot be bypassed
-			
+
 			Conditions
 			- ref_name: [exclude: []] [include: [~ALL]] 
 			- repository_name: [exclude: []] [include: [~ALL]] [protected: true] 
-			
+
 			Rules
 			- commit_author_email_pattern: [name: ] [negate: false] [operator: ends_with] [pattern: @example.com] 
 			- commit_message_pattern: [name: ] [negate: false] [operator: contains] [pattern: asdf]