-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem
When gh stack submit --web operates on a stack with multiple branches, it opens a separate browser tab for every PR that was created or updated. For a stack of N branches, that's N tabs opened in rapid succession.
The --web flag was likely carried over from gh pr create --web semantics, where it makes perfect sense — you're creating one PR and want to see it. But for the "submit the whole stack" use case, carpet-bombing the user with browser tabs is... not great.
Current behavior
In cmd/submit.go, all successfully created/updated PR URLs are collected into a slice, and then each one is opened via browser.Browse():
if openWeb && len(prURLs) > 0 {
b := browser.New("", os.Stdout, os.Stderr)
for _, url := range prURLs {
if err := b.Browse(url); err != nil {
fmt.Fprintf(os.Stderr, "%s could not open browser for %s: %v\n", s.WarningIcon(), url, err)
}
}
}This collects URLs from both newly created PRs and updated existing PRs.
Possible directions
No strong opinion yet on which approach is best. Some options:
- Only open newly created PRs — skip updated ones, since the user already knows about those. This is the least disruptive change.
- Cap the number of tabs — e.g., open up to 3 and print the remaining URLs to the terminal.
- Prompt before opening multiple tabs — something like "About to open 5 tabs, continue? [y/N]".
- Print URLs instead of opening — when N > 1, just print the URLs and let the user pick which to open.
- Some combination — e.g., always open newly created PRs, print URLs for updated ones.
Open to ideas.