-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Description
The help for gh repo delete says:
For safety, when no repository argument is provided, the
--yesflag 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 thedelete_reposcope. To authorize, rungh 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
-
cdinto any local Git repository that is connected to GitHub. -
Run:
gh repo delete --yes
-
Observe that the command prompts interactively (as designed) but does not warn that
--yesis ignored in this mode.
Actual Behavior
--yesis silently ignored when noowner/repoargument is provided.- No warning or error is shown, so users may assume
--yesshould make it non-interactive.
Expected Behavior
- If
--yesis passed without an explicitowner/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)
-
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
-
-
Error out (clearer for scripts/CI):
-
Exit non-zero with:
Error: --yes requires an explicit repository argument (OWNER/REPO) for safety.
-
-
Docs/UI nudge in the prompt:
-
If the prompt appears while
--yeswas 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.