(
    text: str,
    href: Optional[str],
    print_alternative: bool = True,
    width: Optional[int] = None,
    pipe: TextIO = sys.stdout,
)
return text
Prints a clickable hyperlink output if in a tty; otherwise just prints a text link

    :param text: The link anchor text
    :param href: The href, if exists
    :param print_alternative: If true, only emits link if OSC8 links are supported, otherwise prints href after text
    :param width: Minimum link width
    :param pipe: The text IO via which this link will be emitted
    :return: The rendered link
Prints a clickable hyperlink output if in a tty; otherwise just prints a text link
Prints a clickable hyperlink output if in a tty ; otherwise just prints a text link
def render_link(
    text: str,
    href: Optional[str],
    print_alternative: bool = True,
    width: Optional[int] = None,
    pipe: TextIO = sys.stdout,
) -> str:
    """
    Prints a clickable hyperlink output if in a tty; otherwise just prints a text link

    :param text: The link anchor text
    :param href: The href, if exists
    :param print_alternative: If true, only emits link if OSC8 links are supported, otherwise prints href after text
    :param width: Minimum link width
    :param pipe: The text IO via which this link will be emitted
    :return: The rendered link
    """
    is_rendered = False
    if href:  # Don't render if href is None or empty
        if pipe.isatty() and DO_PRINT_LINKS:
            text = f"{OSC_8}{href}{BEL}{text}{OSC_8}{BEL}"
            is_rendered = True
            if width:
                width += LINK_WIDTH + len(href)
        elif print_alternative:
            text = f"{text} {href}"

    if width:
        text = text.ljust(width)

    # Coloring has to occur after justification
    if is_rendered:
        text = style(text, fg=Colors.LINK)

    return text
def render_link ( text : str , href : Optional [ str ] , print_alternative : bool = True , width : Optional [ int ] = None , pipe : TextIO = sys . stdout , ) -> str : is_rendered = False if href : # Don't render if href is None or empty if pipe . isatty ( ) and DO_PRINT_LINKS : text = f"{OSC_8}{href}{BEL}{text}{OSC_8}{BEL}" is_rendered = True if width : width += LINK_WIDTH + len ( href ) elif print_alternative : text = f"{text} {href}" if width : text = text . ljust ( width ) # Coloring has to occur after justification if is_rendered : text = style ( text , fg = Colors . LINK ) return text