feat(style): hyperlink PR numbers in submit output (#105)#107
Open
mvanhorn wants to merge 1 commit intoboneskull:mainfrom
Open
feat(style): hyperlink PR numbers in submit output (#105)#107mvanhorn wants to merge 1 commit intoboneskull:mainfrom
mvanhorn wants to merge 1 commit intoboneskull:mainfrom
Conversation
submit prints "Updating PR #N for branch (base: parent)..." with no URL. Per the issue, the PR number should be the linked text when the terminal supports OSC 8 hyperlinks; otherwise fall back to "text (URL)" so the URL remains visible. Added Hyperlink(text, url) to internal/style/style.go: - Color/TTY enabled: emits OSC 8 escape sequence (\x1b]8;;URL\x1b\\TEXT\x1b]8;;\x1b\\), which renders as a clickable link in iTerm2, kitty, recent macOS Terminal, GNOME Terminal, etc. - Color/TTY disabled (NO_COLOR, piped output, dumb terminal): falls back to "text (url)". - Empty URL: returns text alone, no parens. Updated cmd/submit.go:465 to wrap "PR #N" with Hyperlink() and ghClient.PRURL(d.prNum). The (base: parent) suffix and trailing "... ok" / "failed" are unchanged. Added internal/style/style_test.go covering the three branches (enabled, disabled, empty URL). Closes boneskull#105
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #105.
What changed
`submit` now wraps the `PR #N` token in its progress line with an OSC 8 terminal hyperlink, so iTerm2 / kitty / recent macOS Terminal / GNOME Terminal users can click the PR number to jump to the URL. Terminals without hyperlink support (or sessions where output is piped) get a plain `text (URL)` fallback so the URL is still visible.
Before:
```
Updating PR #3150 for boneskull/additional-locations (base: master)... ok
```
After (TTY with OSC 8): the `PR #3150` is a clickable link to the PR URL.
After (no TTY / NO_COLOR):
```
Updating PR #3150 (https://github.com/boneskull/gh-stack/pull/3150) for boneskull/additional-locations (base: master)... ok
```
How
Why this matches the issue
Quoted from the issue (#105):
That's the OSC 8 path. The fallback is what the issue showed as the alternate render.
Verification