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

Package "cli_table"

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

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
1.0.101a23ee1c70636d05d8c68ade11b1b1e01ad5baff65https://github.com/fnogatz/cli_table/archive/v1.0.10.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(cli_table).

Only for development purposes library(tap) is required. It can be installed by calling ?- pack_install(tap). from within SWI-Prolog.

Usage

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

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

?- Data = [[a,bb,ccc], [111,22,3]],
   Head = ['First', 'Second', 'Third'],
   cli_table(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 "cli_table"

Pack contains 10 files holding a total of 9.7K bytes.