Repository navigation
gh repo delete: warn or error when --yes is ignored without an explicit owner/repo #12033
Description
Activity
Hey @Shion1305, thanks for this! ✨
All good points, and very reasonable solutions 🤔 I'm not sure which option is best but I think I lean towards the option 1 you've presented. I don't think it would hurt to print a message on stderr when
--yesis ignored. I think it would make sense to only print this message to stderr when we can't prompt because we have another message that prints when we cannot prompt, see below.I also want to note that if we can't prompt, we do currently give an error and exit in this case - so that should cover the transparency in CI case:
cli/pkg/cmd/repo/delete/delete.go
Lines 60 to 67 in 0b1b5fe
// 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 } cc @babakks since we worked on this safety feature together - WDYT?
- addedenhancementa request to improve CLIa request to improve CLIgh-reporelating to the gh repo commandrelating to the gh repo command
on Oct 27, 2025 github-actions commented
on Oct 27, 2025 on Oct 27, 2025 – with GitHub ActionsContributorMore actionsThank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wanted
Contributions welcome label, we are not currently looking for external contributions for this feature.If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
Hey @BagToad, thanks for the positive feedback! I’d love to take this on if you’re okay with it. Could you assign me? I can open a PR this week.
Reacted by Kynan WareI agree with @BagToad that we should just print a warning in interactive mode. The other case is already covered with a non-zero exit code and message. I'll put down the A/C in the next comment.
Acceptance Criteria
Given I'm running
ghinteractively from a cloned repo directory
When I rungh repo delete --yes
Then I see the below warning message on stderr and then the prompt to confirm the repo name:Warning: `--yes` is ignored since no repository was specified- addedhelp wantedContributions welcomeContributions welcomeand removedneeds-triageneeds to be reviewedneeds to be reviewed
on Oct 28, 2025 @Shion1305 I just added help wanted
Contributions welcome to this. So, feel free to submit a PR for it.Reacted by Shion Ichikawa- added a commit that references this issue
on Oct 28, 2025 - added a commit that references this issue
on Oct 29, 2025 - added a commit that references this issue
on Nov 6, 2025
Description
The help for
gh repo deletesays:However, when I run
gh repo delete --yes(from inside a repository) there is no warning that--yesis 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:
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.--yesshould make it non-interactive.Expected Behavior
--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:
Error out (clearer for scripts/CI):
Exit non-zero with:
Docs/UI nudge in the prompt:
If the prompt appears while
--yeswas provided, append a one-line note:Rationale
Silently ignoring a flag is surprising and makes troubleshooting slower. A warning or error would: