Skip to content

submit: use terminal links #139

Description

@boneskull

The output when gh stack submit creates a new PR looks like this:

=== Phase 3: PRs ===
✓ Created PR #1234 for boneskull/derp (https://github.com/boneskull/derp/pull/1234)

This should instead use the Hyperlink function:

func (s *Style) Hyperlink(text, url string) string {
if !s.enabled || !s.isTTY || url == "" {
if url == "" {
return text
}
return fmt.Sprintf("%s (%s)", text, url)
}
// OSC 8 hyperlink: ESC]8;;URLESC\TEXTESC]8;;ESC\
return fmt.Sprintf("\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\", url, text)
}

gh stack submit uses this function when emitting a notice about updating a PR; see:

fmt.Printf("Updating %s for %s (base: %s)... ", s.Hyperlink(fmt.Sprintf("PR #%d", d.prNum), ghClient.PRURL(d.prNum)), s.Branch(b.Name), s.Branch(parent))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions