Did you know ... Search Documentation:
Pack clitable -- README.md

CLI Table

Pretty unicode tables for the CLI with Prolog.

Installation

This pack is available from the add-on registry of SWI-Prolog.

It can be installed with pack_install/1:

?- pack_install(clitable).

Usage

This module exports the two predicates clitable(+Data) and clitable(+Data,+Options).

:- use_module(library(clitable)).
?- Data = [[a,bb,ccc], [111,22,3]],
   clitable(Data).
╔═════╤════╤═════╗
║  a  │ bb │ ccc ║
║ 111 │ 22 │  3  ║
╚═════╧════╧═════╝

?- Data = [[a,bb,ccc], [111,22,3]],
   Head = ['First', 'Second', 'Third'],
   clitable(Data, [head(Head)]).
╔═══════╤════════╤═══════╗
║ First │ Second │ Third ║
╟───────┼────────┼───────╢
║   a   │   bb   │  ccc  ║
║  111  │   22   │   3   ║
╚═══════╧════════╧═══════╝

Custom Styles

The style can be changed by setting the appropriate chars in the Options list. The following defaults can be overridden by specifying the corresponding options:

top('═'), top_left('╔'), top_mid('╤'), top_right('╗'),
bottom('═'), bottom_left('╚'), bottom_mid('╧'), bottom_right('╝'),
space(' '), left('║'), mid('│'), right('║'),
mid_space('─'), mid_left('╟'), mid_mid('┼'), mid_right('╢')