(text: str)
Prints text bold, in a header box

    By default, the box is PRINT_WIDTH characters wide, unless the text is too
    long for the box, in which case the box is extended to fit.
Prints text bold, in a header box
Prints text bold in a header box
def echo_box(text: str) -> None:
    """
    Prints text bold, in a header box

    By default, the box is PRINT_WIDTH characters wide, unless the text is too
    long for the box, in which case the box is extended to fit.
    """
    lines = text.split("\n")
    max_len = max(len(l) for l in lines)
    max_len = max(PRINT_WIDTH - 4, max_len)
    hrule = "".ljust(max_len + 2, "─")
    echo_newline()
    secho(f"╭{hrule}╮", err=True)
    for l in lines:
        p = style(f"{l:^{max_len}s}", bold=True)
        secho(f"│ {p} │", err=True)
    secho(f"╰{hrule}╯", err=True)
def echo_box ( text : str ) -> None : lines = text . split ( "\n" ) max_len = max ( len ( l ) for l in lines ) max_len = max ( PRINT_WIDTH - 4 , max_len ) hrule = "" . ljust ( max_len + 2 , "─") echo_newline ( ) secho ( f"╭{hrule}╮", er r Tru e ) for l in lines : p = style ( f"{l:^{max_len}s}" , bold = True ) secho ( f"│ {p} │", er r Tru e ) secho ( f"╰{hrule}╯", er r Tru e )