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

Code before:
	BaseRepo   func() (ghrepo.Interface, error)
	Prompter   iprompter
	IO         *iostreams.IOStreams
	RepoArg    string
	Confirmed  bool
}

func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Command {
	opts := &DeleteOptions{
		IO:         f.IOStreams,
		HttpClient: f.HttpClient,
		BaseRepo:   f.BaseRepo,
		Prompter:   f.Prompter,
	}

	cmd := &cobra.Command{
		Use:   "delete [<repository>]",
		Short: "Delete a repository",
		Long: heredoc.Doc(`
			Delete a GitHub repository.
			
			With no argument, deletes the current repository. Otherwise, deletes the specified repository.

			Deletion requires authorization with the "delete_repo" scope. 
			To authorize, run "gh auth refresh -s delete_repo"
		`),
		Args: cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) > 0 {
				opts.RepoArg = args[0]
			}

			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 {

Review comment (security):
Minor improvement to bring this in line with formatting done in other usage documentation:

```suggestion
		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
		`, "`"),
```

Code after:
	BaseRepo   func() (ghrepo.Interface, error)
	Prompter   iprompter
	IO         *iostreams.IOStreams
	RepoArg    string
	Confirmed  bool
}

func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Command {
	opts := &DeleteOptions{
		IO:         f.IOStreams,
		HttpClient: f.HttpClient,
		BaseRepo:   f.BaseRepo,
		Prompter:   f.Prompter,
	}

	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]
			}

			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 {