Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support env var to force hyperlinks on (or off) #2

Closed
lilyball opened this issue Sep 11, 2021 · 2 comments
Closed

Support env var to force hyperlinks on (or off) #2

lilyball opened this issue Sep 11, 2021 · 2 comments

Comments

@lilyball
Copy link

There should be a way for me, as a user, to explicitly request hyperlinks (or turn them off). Declaring an env var for this is the obvious choice.

Requesting would be for if my terminal supports it but the code hasn’t been updated for it, or if the env var normally used to detect it has been modified (e.g. if I use Kitty and ssh to another machine, I have to reset my TERM as xterm-kitty is not in standard terminfo databases, but doing so means my terminal can’t be detected as Kitty anymore).

Turning it off is for false positives (e.g. my terminal doesn’t support it but has inherited an env var that is used to detect support).

@lilyball
Copy link
Author

For reference, I just found an NPM package called supports-hyperlinks which defines the FORCE_HYPERLINK var. The logic here appears to be "if FORCE_HYPERLINK exists, a value matching /^\s*0+(?!\d)/ means disable hyperlinks, anything else enables them", though I'm not sure they really meant for FORCE_HYPERLINK=0xF to mean disable hyperlinks, I suspect they actually just wanted to trim whitespace.

@zkat zkat closed this as completed in 96d75a7 Sep 16, 2021
@zkat
Copy link
Owner

zkat commented Sep 16, 2021

Fixed :)

bors added a commit to rust-lang/cargo that referenced this issue Nov 8, 2023
feat: Make browser links out of HTML file paths

This provides an alternative to `--open`, where supported.

Note: because we are relying on `supports-hyperlinks`, we are getting `FORCE_HYPERLINK` for "free".  Unsure whether it and the current policy (it gets overridden by `term.hyperlinks`) is something we want.  `FORCE_HYPERLINK` mirrors the npm package's behavior of the same name (see zkat/supports-hyperlinks#2) though though I also found reading of it in ohmyzsh, a go terminal library and many more places.  Similarly, #12751 added indirect, undocumented support for community environment variables.

Fixes #12888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants