terminal_table/renderers

Search:
Group by:

Deterministic ANSI-aware terminal table rendering.

render only returns a string. renderToTerminalWidth is the sole API that queries terminal dimensions, and print is only a convenience.

Procs

proc render(table: Table; maxWidth = 0): string {....raises: [ValueError],
    tags: [], forbids: [].}
Renders a table to a string. maxWidth = 0 uses natural widths; otherwise the complete table, including margins, is fitted to that width.
proc renderToTerminalWidth(table: Table; fallbackWidth = 80): string {.
    ...raises: [ValueError], tags: [ReadEnvEffect], forbids: [].}
Queries the current terminal width at call time and responsively renders. fallbackWidth is used when the terminal cannot report a positive size.