Skip to content

gh repo delete: warn or error when --yes is ignored without an explicit owner/repo #12033

@Shion1305

Description

@Shion1305

Description

The help for gh repo delete says:

For safety, when no repository argument is provided, the --yes flag is ignored and you will be prompted for confirmation. To delete the current repository non-interactively, specify it explicitly (e.g., gh repo delete owner/repo --yes).
Deletion requires authorization with the delete_repo scope. To authorize, run gh auth refresh -s delete_repo.

However, when I run gh repo delete --yes (from inside a repository) there is no warning that --yes is being ignored. This made it hard to understand why the command wasn’t behaving non-interactively.

Steps to Reproduce

  1. cd into any local Git repository that is connected to GitHub.

  2. Run:

    gh repo delete --yes
  3. Observe that the command prompts interactively (as designed) but does not warn that --yes is ignored in this mode.

Actual Behavior

  • --yes is silently ignored when no owner/repo argument is provided.
  • No warning or error is shown, so users may assume --yes should make it non-interactive.

Expected Behavior

  • If --yes is passed without an explicit owner/repo, the CLI should at least warn, or preferably error, explaining why it can’t proceed non-interactively.

Suggested Fixes (any of these would help)

  1. Warn and continue interactively (most conservative):

    • Print to stderr:

      Warning: --yes is ignored when no repository is specified.
      To delete non-interactively, run: gh repo delete OWNER/REPO --yes
      
  2. Error out (clearer for scripts/CI):

    • Exit non-zero with:

      Error: --yes requires an explicit repository argument (OWNER/REPO) for safety.
      
  3. Docs/UI nudge in the prompt:

    • If the prompt appears while --yes was provided, append a one-line note:

      Note: --yes is ignored without an explicit repository. Use: gh repo delete OWNER/REPO --yes
      

Rationale

Silently ignoring a flag is surprising and makes troubleshooting slower. A warning or error would:

  • Align behavior with the help text.
  • Prevent confusion for users expecting non-interactive deletion.
  • Help CI scripts fail fast with a clear message rather than hanging on a prompt.

Metadata

Metadata

Labels

enhancementa request to improve CLIfeedbackgh-reporelating to the gh repo commandhelp wantedContributions welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions