Repository: cli/cli
File: pkg/cmd/repo/rename/rename.go (Go)

Code before:

func NewCmdRename(f *cmdutil.Factory, runf func(*RenameOptions) error) *cobra.Command {
	opts := &RenameOptions{
		IO:         f.IOStreams,
		HttpClient: f.HttpClient,
		GitClient:  f.GitClient,
		Remotes:    f.Remotes,
		Config:     f.Config,
		Prompter:   f.Prompter,
	}

	var confirm bool

	cmd := &cobra.Command{
		Use:   "rename [<new-name>]",
		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.

			For more information on transferring repository ownership, see:
			<https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>
			`, "`"),
		Example: heredoc.Doc(`
			# Rename the current repository (foo/bar -> foo/baz)
			$ gh repo rename baz

			# Rename the specified repository (qux/quux -> qux/baz)
			$ gh repo rename -R qux/quux baz
		`),
		Args: cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			opts.BaseRepo = f.BaseRepo
			opts.HasRepoOverride = cmd.Flags().Changed("repo")

			if len(args) > 0 {
				opts.newRepoSelector = args[0]
			} else if !opts.IO.CanPrompt() {
				return cmdutil.FlagErrorf("new name argument required when not running interactively")
			}

			if len(args) == 1 && !confirm && !opts.HasRepoOverride {
				if !opts.IO.CanPrompt() {
					return cmdutil.FlagErrorf("--yes required when passing a single argument")

Review comment (suggestion):
```suggestion
			you must follow additional steps on GitHub.com
```

Code after:

func NewCmdRename(f *cmdutil.Factory, runf func(*RenameOptions) error) *cobra.Command {
	opts := &RenameOptions{
		IO:         f.IOStreams,
		HttpClient: f.HttpClient,
		GitClient:  f.GitClient,
		Remotes:    f.Remotes,
		Config:     f.Config,
		Prompter:   f.Prompter,
	}

	var confirm bool

	cmd := &cobra.Command{
		Use:   "rename [<new-name>]",
		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

			For more information on transferring repository ownership, see:
			<https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>
			`, "`"),
		Example: heredoc.Doc(`
			# Rename the current repository (foo/bar -> foo/baz)
			$ gh repo rename baz

			# Rename the specified repository (qux/quux -> qux/baz)
			$ gh repo rename -R qux/quux baz
		`),
		Args: cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			opts.BaseRepo = f.BaseRepo
			opts.HasRepoOverride = cmd.Flags().Changed("repo")

			if len(args) > 0 {
				opts.newRepoSelector = args[0]
			} else if !opts.IO.CanPrompt() {
				return cmdutil.FlagErrorf("new name argument required when not running interactively")
			}

			if len(args) == 1 && !confirm && !opts.HasRepoOverride {
				if !opts.IO.CanPrompt() {
					return cmdutil.FlagErrorf("--yes required when passing a single argument")