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

Code before:
	cmd := &cobra.Command{
		Use:   "delete [<repository>]",
		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.
			To authorize, run %[1]sgh auth refresh -s delete_repo%[1]s
		`, "`"),
		Args: cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) > 0 {
				opts.RepoArg = args[0]
			}

			// Ignore --yes when no argument provided to prevent accidental deletion
			if len(args) == 0 && opts.Confirmed {
				if opts.IO.CanPrompt() {
					// Interactive mode: ignore --yes flag and force confirmation
					opts.Confirmed = false
				} else {
					// Non-interactive mode: return error
					return cmdutil.FlagErrorf("--yes flag is ignored when no repository argument is provided. Please specify a repository to delete or run interactively")
				}
			}

			if !opts.IO.CanPrompt() && !opts.Confirmed {
				return cmdutil.FlagErrorf("--yes required when not running interactively")
			}

			if runF != nil {
				return runF(opts)
			}

			return deleteRun(opts)
		},
	}

	cmd.Flags().BoolVar(&opts.Confirmed, "confirm", false, "Confirm deletion without prompting")
	_ = cmd.Flags().MarkDeprecated("confirm", "use `--yes` instead")
	cmd.Flags().BoolVar(&opts.Confirmed, "yes", false, "Confirm deletion without prompting")
	return cmd
}

func deleteRun(opts *DeleteOptions) error {
	httpClient, err := opts.HttpClient()
	if err != nil {
		return err
	}

Review comment (suggestion):
@copilot can this block be flipped to avoid the `else`? 

Example:

```Go
if !opts.IO.CanPrompt() {
    return cmdutil.FlagErrorf("cannot non-interactively delete current repository. Please specify a repository or run interactively")
}
opts.Confirmed = false
```


Code after:
	cmd := &cobra.Command{
		Use:   "delete [<repository>]",
		Short: "Delete a repository",
		Long: heredoc.Docf(`
			Delete a GitHub repository.

			With no argument, deletes the current repository. Otherwise, deletes the specified repository.
			
			For safety, when no repository argument is provided, the %[1]s--yes%[1]s flag is ignored 
			and you will be prompted for confirmation. To delete the current repository non-interactively, 
			specify it explicitly (e.g., %[1]sgh repo delete owner/repo --yes%[1]s).

			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),
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) > 0 {
				opts.RepoArg = args[0]
			}

			// Ignore --yes when no argument provided to prevent accidental deletion
			if len(args) == 0 && opts.Confirmed {
				if !opts.IO.CanPrompt() {
					return cmdutil.FlagErrorf("cannot non-interactively delete current repository. Please specify a repository or run interactively")
				}
				opts.Confirmed = false
			}

			if !opts.IO.CanPrompt() && !opts.Confirmed {
				return cmdutil.FlagErrorf("--yes required when not running interactively")
			}

			if runF != nil {
				return runF(opts)
			}

			return deleteRun(opts)
		},
	}

	cmd.Flags().BoolVar(&opts.Confirmed, "confirm", false, "Confirm deletion without prompting")
	_ = cmd.Flags().MarkDeprecated("confirm", "use `--yes` instead")
	cmd.Flags().BoolVar(&opts.Confirmed, "yes", false, "Confirm deletion without prompting")
	return cmd
}

func deleteRun(opts *DeleteOptions) error {
	httpClient, err := opts.HttpClient()
	if err != nil {
		return err