Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "clitable"

Title:Pretty unicode tables for the CLI with Prolog
Rating:Not rated. Create the first rating!
Latest version:1.0.3
SHA1 sum:49abb45c539857bc06067ab3262a087d2c20f050
Author:Falco Nogatz <fnogatz@gmail.com>
Maintainer:Falco Nogatz <fnogatz@gmail.com>
Packager:Falco Nogatz <fnogatz@gmail.com>
Home page:https://github.com/fnogatz/clitable
Download URL:https://github.com/fnogatz/clitable/releases/*.zip

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
1.0.0d86aefb08de1f3a58f426ccf6798550973c000f81https://github.com/fnogatz/clitable/archive/v1.0.0.zip
1.0.15726e43b42eaf7396121f53247486ae7e38e611b1https://github.com/fnogatz/clitable/archive/v1.0.1.zip
1.0.2cb5c098155bb2a0da16cc1286d3e077875ba4b191https://github.com/fnogatz/clitable/archive/v1.0.2.zip
1.0.349abb45c539857bc06067ab3262a087d2c20f0504https://github.com/fnogatz/clitable/archive/v1.0.3.zip

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('─'), mid_left('╟'), mid_mid('┼'), mid_right('╢')

Contents of pack "clitable"

Pack contains 6 files holding a total of 6.5K bytes.