Only hyperlink when stdout is a tty
This commit is contained in:
parent
a59e1adee1
commit
033950dae9
1 changed files with 3 additions and 1 deletions
|
|
@ -156,7 +156,9 @@ def env(x: str) -> str:
|
|||
|
||||
|
||||
def hyperlink_for_url(url: str, text: str) -> str:
|
||||
return f'\x1b]8;;{url}\x1b\\\x1b[4:3;58:5:4m{text}\x1b[4:0;59m\x1b]8;;\x1b\\'
|
||||
if sys.stdout.isatty():
|
||||
return f'\x1b]8;;{url}\x1b\\\x1b[4:3;58:5:4m{text}\x1b[4:0;59m\x1b]8;;\x1b\\'
|
||||
return text
|
||||
|
||||
|
||||
@role
|
||||
|
|
|
|||
Loading…
Reference in a new issue