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.8
SHA1 sum:622d1fcb230000b2922219ff0b5ada9aadb72082
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.349abb45c539857bc06067ab3262a087d2c20f05010https://github.com/fnogatz/clitable/archive/v1.0.3.zip
1.0.67194fb1c5716d377a8a792b46e96f8b75dcdbe451https://github.com/fnogatz/clitable/archive/v1.0.6.zip
1.0.7bc39a30a7a0263b854b7f65c64a1b10aa7c6bc3d1https://github.com/fnogatz/clitable/archive/v1.0.7.zip
1.0.805b580eb794d5f91cd2a2ca2d5e176852005461314https://github.com/fnogatz/clitable/archive/v1.0.8.zip
622d1fcb230000b2922219ff0b5ada9aadb7208225https://github.com/fnogatz/clitable/archive/v1.0.8.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_space('─'), mid_left('╟'), mid_mid('┼'), mid_right('╢')

Contents of pack "clitable"

Pack contains 9 files holding a total of 8.7K bytes.