├── .gitignore ├── .travis.yml ├── Makefile ├── README.rst ├── libtable.2.rst ├── libtable.awk ├── table ├── table.1.rst └── test ├── data1.txt ├── data2.txt ├── data_fs.txt ├── empty_lines.ok ├── empty_lines.test ├── fs.ok ├── fs.test ├── jira-noheader.ok ├── jira-noheader.test ├── jira.ok ├── jira.test ├── left_margin.ok ├── left_margin.test ├── missing_cols.ok ├── missing_cols.test ├── no-header.ok ├── no-header.test ├── normal.ok ├── normal.test ├── rs.ok ├── rs.test ├── rst-no-header.ok ├── rst-no-header.test ├── rst.ok ├── rst.test ├── runtests.sh ├── style-md.ok ├── style-md.test ├── style-rst.ok ├── style-rst.test ├── title_left_margin.ok ├── title_left_margin.test ├── title_psql.ok ├── title_psql.test ├── title_rst.ok ├── title_rst.test ├── title_too_long.ok └── title_too_long.test /.gitignore: -------------------------------------------------------------------------------- 1 | *.gz 2 | ngetopt.awk 3 | test/*.out 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | script: make test 3 | after_failure: make show-failing-tests 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash -O nullglob 2 | 3 | .PHONY: test 4 | test: ngetopt.awk 5 | test/runtests.sh 6 | 7 | .PHONY: man 8 | man: .ensure-rst2man.py table.1.gz libtable.2.gz 9 | 10 | .PHONY: ngetopt.awk 11 | ngetopt.awk: 12 | gawk -i ngetopt 'BEGIN{exit}' 2>/dev/null || curl -sSL https://raw.githubusercontent.com/joepvd/ngetopt.awk/master/ngetopt.awk >ngetopt.awk 13 | 14 | %.gz: %.rst 15 | rst2man.py $< | gzip >$@ 16 | 17 | .PHONY: .ensure-rst2man.py 18 | .ensure-rst2man.py: 19 | @command -v rst2man.py >/dev/null 20 | 21 | .PHONY: show-failing-tests 22 | show-failing-tests: 23 | for f in test/*.out; do head $$f $${f/out}ok; done 24 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | table 2 | ===== 3 | 4 | Facts become valuable if they are presented attractively. Console junkies often need to take refuge to spreadsheet programs to display and present their findings to customers and managers. ``table`` attempts to obliterate the need to interrupt the console workflow by presenting tabular data in a human digestible form. 5 | 6 | Let the console speak for itself: 7 | 8 | .. code:: 9 | 10 | % ps | table 11 | ┌─────┬───────┬──────────┬───────┐ 12 | │ PID │ TTY │ TIME │ CMD │ 13 | ├─────┼───────┼──────────┼───────┤ 14 | │ 139 │ pts/3 │ 00:00:00 │ zsh │ 15 | │ 219 │ pts/3 │ 00:00:00 │ ps │ 16 | │ 220 │ pts/3 │ 00:00:00 │ table │ 17 | └─────┴───────┴──────────┴───────┘ 18 | 19 | 20 | ``table`` receives input on `STDIN` or from file(s), and makes an attractive looking table from this. A growing number of options and output numbers is supported. As ``table`` is written in ``gawk`` version 4 or more recent, all goodies like regex support for field splitting are available. Some highlights (consult `man 1 table` for for an extensive list): 21 | 22 | --rst 23 | Output a table for reStructuredText 24 | 25 | --md 26 | Output a Markdown table 27 | 28 | --jira 29 | Output a Jira formatted table 30 | 31 | --title STRING 32 | Set a centered title spanning all the columns. 33 | 34 | --field-separator 35 | Define the AWK-field separator to be used. 36 | 37 | --no-header 38 | Do not display titles for columns. 39 | 40 | libtable.awk 41 | ++++++++++++ 42 | 43 | ``table`` is a front end for the included ``gawk`` library ``libtable``. This is of interest to ``gawk`` programmers, and allows an array to be passed to ``make_table``, after which a properly formatted table will be returned. 44 | 45 | As of yet, the library should be considered unstable. The usage of global variables for configuration is conventient, yet wrong. Attemps to make this nicer resulted in ugliness. Suggestions are welcome. 46 | 47 | Installation 48 | ++++++++++++ 49 | 50 | The ``table`` command depends on ``gawk`` version 4 or newer. And the command line processing library ngetopt.awk_. 51 | 52 | .. _ngetopt.awk: https://github.com/joepvd/ngetopt.awk 53 | 54 | Make sure that ``libtable.awk`` and ``ngetopt.awk`` are in ``AWKPATH``. On many distributions, this will be ``/usr/share/awk``, or ``/usr/local/share/awk`` (OS X). You can find out what ``AWKPATH`` is by executing ``gawk 'BEGIN{print ENVIRON["GAWKPATH"]}'``. 55 | 56 | 57 | Bugs 58 | ++++ 59 | 60 | Probably. Pull requests or issues welcome over at GitHub_. 61 | 62 | .. _GitHub: https://github.com/joepvd/table 63 | -------------------------------------------------------------------------------- /libtable.2.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | libtable 3 | ======== 4 | 5 | ---------------------------------------------------------- 6 | Returns string containing table from two-dimensional array 7 | ---------------------------------------------------------- 8 | 9 | 10 | DESCRIPTION 11 | =========== 12 | 13 | ``gawk`` library that converts a two-dimensional array into a string with a nicely formatted table. Closely tight to the user command ``table``. **WARNING** this library is not yet stable. 14 | 15 | 16 | USAGE 17 | ===== 18 | 19 | .. code:: 20 | 21 | @include "libtable" 22 | printf make_table(two_dimensional_array) 23 | 24 | 25 | 26 | gawk library to represent a two dimensional array in a visually attractive table. 27 | 28 | CONFIGURATION 29 | ============= 30 | 31 | The interface is not stable yet. Claiming this list of global variables probably is not a good idea. I have, however, not yet come to an elegant solution. 32 | 33 | 34 | Configuration happens through global variables. The following are listened to: 35 | 36 | style 37 | The style of the table. Currently recongnized: ``psql``, ``rst``, and ``md``. 38 | 39 | debug 40 | Put debugging info to STDERR 41 | 42 | header 43 | Default: Yes. Set to ``no`` to disable the header. 44 | 45 | _table_left_margin 46 | String to prepend each table line with. 47 | -------------------------------------------------------------------------------- /libtable.awk: -------------------------------------------------------------------------------- 1 | # libtable.awk 2 | # 3 | # gawk library to generate good looking tables from text data, Comes 4 | # with the `table' user command. Depends on ngetopt.awk for command 5 | # line option parsing. 6 | # 7 | # Written by Joep van Delft, 2014, 2015. 8 | # 9 | # Released under GPLv2, see LICENSE. 10 | # 11 | # https://joepvd.github.com/table 12 | 13 | function make_table(contents, i,j) { 14 | # The only user entry point for this library. Takes one array as argument. 15 | # Returns a string containing the whole table. 16 | if (! isarray(contents)) { 17 | printf "libtable: Need to receive an array with contents to" >"/dev/stderr" 18 | printf "function `make_table()'\nExiting.\n" >"/dev/stderr" 19 | _assert_exit = 1 20 | exit 21 | } 22 | _table_analyze(contents) 23 | return _table_styler(contents) 24 | } 25 | 26 | function _table_analyze(contents, 27 | row, col, left, fill, middle, right) { 28 | left=1; fill=2; middle=3; right=4; 29 | if (style == "") 30 | style = "psql" 31 | # Define some arrays containing special characters. 32 | if (style == "psql") { 33 | split("┌─┬┐", _table_head, "") 34 | split("├─┼┤", _table_sep, "") 35 | split("│ ││", _table_row, "") 36 | split("└─┴┘", _table_foot, "") 37 | } 38 | if (style == "rst") { 39 | split("+=++", _table_title, "") 40 | split("+-++", _table_head, "") 41 | split("+=++", _table_sep, "") 42 | split("| ||", _table_row, "") 43 | split("+-++", _table_foot, "") 44 | } 45 | if (style == "psql" && title != "") { 46 | split("╒══╕", _table_title, "") 47 | split("╞═╤╡", _table_head, "") 48 | } 49 | if (title != "" && style == "rst") { 50 | split("+=++", _table_head, "") 51 | } 52 | if (style == "rst" && _table_left_margin == "") { 53 | _table_left_margin = " " 54 | } 55 | if (style == "md") { 56 | split("^^^^", _table_title, "") # ^ will be skipped 57 | split("^^^^", _table_head, "") # ^ will be skipped 58 | split("| ;-; | ; |", _table_sep, ";") 59 | split("| ||", _table_row, "") 60 | split("^^^^", _table_foot, "") # ^ will be skipped 61 | } 62 | if (style == "jira") { 63 | split("^^^^", _table_title, "") # ^ will be skipped 64 | split("^^^^", _table_head, "") # ^ will be skipped 65 | split("||; ;||;||", _table_head_row, ";") 66 | split("^^^^", _table_sep, "") # will be skipped 67 | split("| ; ;| ; |", _table_row, ";") 68 | if (header == "no") { 69 | split("| ||", _table_row, "") 70 | } 71 | split("^^^^", _table_foot, "") # ^ will be skipped 72 | } 73 | 74 | # Adds some meta data to the array `contents'. 75 | if (! ("row_count" in contents)) { 76 | contents["row_count"] = length(contents) 77 | } 78 | # Warning: O(n^2) 79 | for (row=1; row in contents; row++) { 80 | contents["col_count"] = _table_max(contents["col_count"], 81 | length(contents[row])) 82 | for (col=1; col in contents[row]; col++) { 83 | if (style == "md" && row == 1) { 84 | contents["len"][col] = 3 85 | } 86 | contents["len"][col] = _table_max(contents["len"][col], 87 | length(contents[row][col])) 88 | } 89 | } 90 | } 91 | 92 | function _table_styler(contents, string, i, j, empty) { 93 | for (j=1; j<=contents["col_count"]; j++) 94 | empty[j] = "" 95 | for (i=1; i<=contents["row_count"]; i++) { 96 | if (i == 1) { 97 | if (style != "jira") { 98 | string = string _table_format_line(empty, "head", contents) 99 | } 100 | if (title != "") { 101 | string = _table_make_title(title, contents["len"]) string 102 | } 103 | } 104 | if (style=="rst" && ( i>2 || i==2 && header == "no")) 105 | string = string _table_format_line(empty, "foot", contents) # Semantic bug 106 | if (i==1 && length( _table_head_row) > 0 && header != "no") { 107 | # jira formats the table row with contents special 108 | string = string _table_format_line(contents[i], "head_row", contents) 109 | } else { 110 | # The main processor 111 | string = string _table_format_line(contents[i], "row", contents) 112 | } 113 | if (i==1 && header~/^(y|)$/) 114 | string = string _table_format_line(empty, "sep", contents) 115 | if (i==contents["row_count"]) 116 | string = string _table_format_line(empty, "foot", contents) 117 | } 118 | return string 119 | } 120 | 121 | function _table_make_title(title, arr, 122 | i, s, len, 123 | left, fill, middle, right) { 124 | left=1; fill=2; middle=3; right=4; 125 | 126 | if (SYMTAB["_table_title"][left] == "^" && SYMTAB["_table_title"][fill] == "^" && SYMTAB["_table_title"][middle] == "^" && SYMTAB["_table_title"][right] == "^") { 127 | return 128 | } 129 | 130 | for (c in arr) 131 | len += arr[c] 132 | len = len \ 133 | + 2 * ( length(_table_row[left]) + length(_table_row[right]) ) \ 134 | + 3 * ( length(arr) - 1 ) \ 135 | - 4 136 | # the first line: 137 | s = _table_left_margin \ 138 | _table_title[left] \ 139 | _table_pad_left("", len, _table_title[fill]) \ 140 | _table_title[right] "\n" 141 | # The second line: 142 | s = s \ 143 | _table_left_margin \ 144 | _table_row[left] \ 145 | _table_pad_center(title, len, " ") \ 146 | _table_row[right] "\n" 147 | return s 148 | } 149 | 150 | function _table_format_line(line, role, contents, 151 | line_str, glyph, i, cell, len, 152 | left, fill, middle, right) { 153 | # Variable initialization for character retrieval: 154 | left=1; fill=2; middle=3; right=4; 155 | 156 | glyph = "_table_"role 157 | 158 | if (SYMTAB[glyph][left] == "^" && SYMTAB[glyph][fill] == "^" && SYMTAB[glyph][middle] == "^" && SYMTAB[glyph][right] == "^") { 159 | return 160 | } 161 | 162 | # And construct string: 163 | for (i=1; i<=contents["col_count"]; i++) { 164 | cell = line[i] 165 | # Remove trailing newlines (needed for custom record seperator): 166 | sub(/[\r\n]+$/, "", cell) 167 | len = contents["len"][i] 168 | if (role == "sep") { 169 | len = len - 2 * int(length(SYMTAB[glyph][middle])/2) 170 | } 171 | cell = _table_pad_left(cell, len, SYMTAB[glyph][fill]) 172 | if (i == 1) { 173 | line_str = _table_left_margin SYMTAB[glyph][left] cell 174 | } else { 175 | line_str = line_str SYMTAB[glyph][middle] cell 176 | } 177 | } 178 | return line_str SYMTAB[glyph][right] "\n" 179 | } 180 | 181 | function _table_pad_left(string, width, padchar, _s) { 182 | if ( length(string) > width ) 183 | string = substr(string, 1, width) 184 | if (length(padchar) == 0) { 185 | return string 186 | } 187 | _s = padchar string 188 | while ( length(_s) <= width ) 189 | _s = _s padchar 190 | return _s padchar 191 | } 192 | 193 | function _table_pad_right(string, width, padchar, _s) { 194 | if ( length(string) > width ) 195 | string = substr(string, 1, width) 196 | if (length(padchar)==0) { 197 | return string 198 | } 199 | _s = string padchar 200 | while (length(_s) <= width) 201 | _s = padchar _s 202 | return padchar _s 203 | } 204 | 205 | function _table_pad_center(string, width, padchar, _s) { 206 | if ( length(string) > width ) 207 | string = substr(string, 1, width) 208 | _s = padchar string 209 | while (length(_s) <= width) { 210 | if (length(_s)%2 == 0) 211 | _s = _s padchar 212 | else 213 | _s = padchar _s 214 | } 215 | return _s padchar 216 | } 217 | 218 | function _table_max(x, y) { 219 | return x>y?x:y 220 | } 221 | 222 | END { 223 | if (length(_assert_exit) > 0) 224 | exit _assert_exit 225 | } 226 | 227 | # vim: ts=4 sw=4 sts=4 et 228 | -------------------------------------------------------------------------------- /table: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gawk -E 2 | # 3 | # A small program to generate good looking tables from text data, 4 | # powered by all the field splitting magic that awk provides. Type 5 | # `table --help` for usage details. 6 | # 7 | # This is a user interface for the libtable.awk library, which can be 8 | # used from other programs. 9 | # 10 | # Depends on ngetopt.awk for command line option parsing. 11 | # 12 | # Written by Joep van Delft, 2014, 2015, 2019 13 | 14 | @include "ngetopt.awk" 15 | @include "libtable" 16 | @include "walkarray" 17 | 18 | function display_version( p) { 19 | split(ENVIRON["_"], p, "/") 20 | return sprintf("%s version %s", p[length(p)], "v0.3.0") 21 | } 22 | 23 | BEGIN { 24 | #opt_debug="y" 25 | regopt("short=s; long=style; flag=style; has_arg=yes; vals=rst|psql|md|jira; desc=Select output style.") 26 | regopt("short=d; long=debug; flag=debug; has_arg=no; desc=Output debugging stuff") 27 | regopt("short=h; long=help; flag=help; has_arg=no; desc=Show usage information") 28 | regopt("short=v; long=version; flag=version; has_arg=no; desc=Show version information") 29 | regopt("short=F; long=field-separator; flag=FS; has_arg=yes; desc=Sets the field separator") 30 | regopt("short=R; long=record-separator; flag=RS; has_arg=yes; desc=Sets the record separator") 31 | regopt("short=H; long=no-header; flag=header; val=no; has_arg=no; desc=Disable header") 32 | regopt("short=F; long=field-separator; flag=FS; has_arg=yes; desc=Sets the field separator") 33 | regopt("short=T; long=title; flag=title; has_arg=yes; desc=Set argument as title") 34 | regopt("long=rst; flag=style; val=rst; has_arg=no; desc=Style reStructuredText") 35 | regopt("long=psql; flag=style; val=psql; has_arg=no; desc=Style Unicode psql") 36 | regopt("long=md; flag=style; val=md; has_arg=no; desc=Style markdown") 37 | regopt("long=jira; flag=style; val=jira; has_arg=no; desc=Style jira") 38 | regopt("long=left-margin; flag=_table_left_margin; has_arg=yes; desc=Sets the left margin") 39 | 40 | parseopt(opt) 41 | 42 | if (version == "yes") { 43 | _assert_exit = 0 44 | print display_version() 45 | exit 46 | } 47 | if (help == "yes") { 48 | print display_version() 49 | print usage() 50 | _assert_exit = 0 51 | exit 52 | } 53 | if ((style == "md" || style == "jira") && length(title)>0) { 54 | printf("Title is not supported with style %s. Ignoring.\n", style)>"/dev/stderr" 55 | } 56 | offset = 0 57 | } 58 | 59 | { 60 | # Storing the records in a two-dimensional array `contents'. 61 | # Ignore empty lines, while respecting the demand for consecutive indexes: 62 | if (NF == 0) { 63 | offset++ 64 | next 65 | } 66 | # Some silly trick to convince `split' that `contents[NR]' really 67 | # is an array. 68 | contents[NR - offset]["a"]=1 69 | split($0, contents[NR - offset]) 70 | delete contents[NR - offset]["a"] 71 | } 72 | 73 | END { 74 | printf make_table(contents) 75 | if (debug == "yes") 76 | walk_array(contents, "contents") 77 | } 78 | 79 | # vim: ts=4 sw=4 sts=4 et 80 | -------------------------------------------------------------------------------- /table.1.rst: -------------------------------------------------------------------------------- 1 | ===== 2 | table 3 | ===== 4 | 5 | ----------------------- 6 | Display text in a table 7 | ----------------------- 8 | 9 | :Author: joepvd 10 | :Date: 2015-03-29 11 | :Copyright: GPLv2 12 | :Version: 0.3 13 | :Manual section: 1 14 | :Manual group: Text processing 15 | 16 | SYNOPSIS 17 | ======== 18 | 19 | 20 | table [-h|--help] [-F|--field-separator] [-R|--record-separator] [-H|--no-header] [-d|--debug] 21 | [-s|--style [rst|psql|md|jira]|--rst|--psql|--md|--jira] [files] 22 | 23 | DESCRIPTION 24 | =========== 25 | 26 | ``table`` takes text as fields and records and transforms it as a table. Inspiration has been taken from the excellent capabilities of ``psql``, the default query tool of PostgreSQL. Output can be as a ``reStructuredText``-table or with unicode line characters. Field and record splitting, the facilities of ``awk`` are enabled. 27 | 28 | 29 | OPTIONS 30 | ======= 31 | 32 | -h|--help 33 | display usage info 34 | 35 | -s|--style 36 | Select a table formatting style. Currently available are **md**, **rst**, **jira**, and **psql** (default). 37 | 38 | --rst 39 | Short for ``--style rst`` 40 | 41 | --psql 42 | Short for ``--style psql`` 43 | 44 | --md 45 | Short for ``--style md`` 46 | 47 | --jira 48 | Short for ``--style jira`` 49 | 50 | -F|--field-separator 51 | Equivalent to ``awk``. Set the field separator. Default is ``[ \t\n]+``. Example: ``-F,`` separates on comma's. 52 | 53 | -R|--record-separator 54 | Set the record separator for input files. 55 | 56 | -H|--no-header 57 | Do not consider the first line of input as the table header. 58 | 59 | -T|--title 60 | Set a title. This string will be centered along the width of the whole table. (Not supported for markdown and jira) 61 | 62 | -d|--debug 63 | Output debugging info. 64 | 65 | --left-margin 66 | Prepend the resulting table with an arbitrary string. Handy for outlining. 67 | 68 | DEPENDENCIES 69 | ============ 70 | 71 | ``table`` depends on the ``gawk`` version 4 or newer, and the command line option processing library ``ngetopt.awk``, available from https://github.com/joepvd/ngetopt.awk. 72 | 73 | 74 | BUGS 75 | ==== 76 | 77 | Please send a pull request or open a ticket on https://github.com/joepvd/table. 78 | 79 | 80 | SEE ALSO 81 | ======== 82 | 83 | ``libtable(2)`` 84 | -------------------------------------------------------------------------------- /test/data1.txt: -------------------------------------------------------------------------------- 1 | aa aaaaaaaaaa aaaaaaa 2 | bbbbbbbbbbbbb bbbb bbbbbbb 3 | cc cccccc ccccccccccccccccccccccccccccccccc 4 | dd dddd dddddd 5 | -------------------------------------------------------------------------------- /test/data2.txt: -------------------------------------------------------------------------------- 1 | a aa aaaaaaaaaa aaaaaaa a 2 | b bbbbbbbbbbbbb bbbb bbbbbbb b 3 | c cc cccccc ccccccccccccccccccccccccccccccccc c 4 | d dd dddd dddddd d 5 | -------------------------------------------------------------------------------- /test/data_fs.txt: -------------------------------------------------------------------------------- 1 | aa ; aa;aaaaaaa 2 | bbbbb;bb ; bbbbbbbbbbbbbbbbbbbb 3 | cc;ccccc; cccccccccccccccc 4 | -------------------------------------------------------------------------------- /test/empty_lines.ok: -------------------------------------------------------------------------------- 1 | ┌─────┬──────────────┐ 2 | │ aa │ aaaa │ 3 | ├─────┼──────────────┤ 4 | │ bbb │ bbbbbbbbbbbb │ 5 | │ cc │ ccccccc │ 6 | └─────┴──────────────┘ 7 | -------------------------------------------------------------------------------- /test/empty_lines.test: -------------------------------------------------------------------------------- 1 | ../table <&1 49 | echo " ${green}✔${reset} Passed: $testname" 50 | } 51 | 52 | # Advance to working directory, clear the field. 53 | cd "${0%/*}" || exit 1 54 | command rm -f *.out || exit 1 55 | 56 | for testcase in *.test; do 57 | testname="${testcase%.*}" 58 | # Do the test. 59 | bash "${testname}.test" >"${testname}.out" 2>&1 60 | 61 | if ! [ -r "${testname}.ok" ] 62 | then 63 | fail "No output to compare to." 64 | continue 65 | fi 66 | if diff "${testname}.out" "${testname}.ok" >/dev/null 2>&1 67 | then 68 | pass 69 | else 70 | fail 71 | fi 72 | done 73 | 74 | echo "Total tests: $(($failed+$passed))" 75 | echo "Failed: $failed" 76 | echo "Passed: $passed" 77 | 78 | (($failed==0)) && exit 0 || exit 1 79 | -------------------------------------------------------------------------------- /test/style-md.ok: -------------------------------------------------------------------------------- 1 | | a | aa | aaaaaaaaaa | aaaaaaa | a | 2 | | --- | ------------- | ---------- | --------------------------------- | --- | 3 | | b | bbbbbbbbbbbbb | bbbb | bbbbbbb | b | 4 | | c | cc | cccccc | ccccccccccccccccccccccccccccccccc | c | 5 | | d | dd | dddd | dddddd | d | 6 | -------------------------------------------------------------------------------- /test/style-md.test: -------------------------------------------------------------------------------- 1 | ../table --md data2.txt 2 | -------------------------------------------------------------------------------- /test/style-rst.ok: -------------------------------------------------------------------------------- 1 | +---------------+------------+-----------------------------------+ 2 | | aa | aaaaaaaaaa | aaaaaaa | 3 | +===============+============+===================================+ 4 | | bbbbbbbbbbbbb | bbbb | bbbbbbb | 5 | +---------------+------------+-----------------------------------+ 6 | | cc | cccccc | ccccccccccccccccccccccccccccccccc | 7 | +---------------+------------+-----------------------------------+ 8 | | dd | dddd | dddddd | 9 | +---------------+------------+-----------------------------------+ 10 | -------------------------------------------------------------------------------- /test/style-rst.test: -------------------------------------------------------------------------------- 1 | ../table --rst data1.txt 2 | -------------------------------------------------------------------------------- /test/title_left_margin.ok: -------------------------------------------------------------------------------- 1 | > +================================================================+ 2 | > | now or never | 3 | > +===============+============+===================================+ 4 | > | aa | aaaaaaaaaa | aaaaaaa | 5 | > +===============+============+===================================+ 6 | > | bbbbbbbbbbbbb | bbbb | bbbbbbb | 7 | > +---------------+------------+-----------------------------------+ 8 | > | cc | cccccc | ccccccccccccccccccccccccccccccccc | 9 | > +---------------+------------+-----------------------------------+ 10 | > | dd | dddd | dddddd | 11 | > +---------------+------------+-----------------------------------+ 12 | -------------------------------------------------------------------------------- /test/title_left_margin.test: -------------------------------------------------------------------------------- 1 | ../table --left-margin "> " --title "now or never" --rst data1.txt 2 | -------------------------------------------------------------------------------- /test/title_psql.ok: -------------------------------------------------------------------------------- 1 | ╒════════════════════════════════════════════════════════════════╕ 2 | │ now or never │ 3 | ╞═══════════════╤════════════╤═══════════════════════════════════╡ 4 | │ aa │ aaaaaaaaaa │ aaaaaaa │ 5 | ├───────────────┼────────────┼───────────────────────────────────┤ 6 | │ bbbbbbbbbbbbb │ bbbb │ bbbbbbb │ 7 | │ cc │ cccccc │ ccccccccccccccccccccccccccccccccc │ 8 | │ dd │ dddd │ dddddd │ 9 | └───────────────┴────────────┴───────────────────────────────────┘ 10 | -------------------------------------------------------------------------------- /test/title_psql.test: -------------------------------------------------------------------------------- 1 | ../table --title "now or never" data1.txt 2 | -------------------------------------------------------------------------------- /test/title_rst.ok: -------------------------------------------------------------------------------- 1 | +================================================================+ 2 | | now or never | 3 | +===============+============+===================================+ 4 | | aa | aaaaaaaaaa | aaaaaaa | 5 | +===============+============+===================================+ 6 | | bbbbbbbbbbbbb | bbbb | bbbbbbb | 7 | +---------------+------------+-----------------------------------+ 8 | | cc | cccccc | ccccccccccccccccccccccccccccccccc | 9 | +---------------+------------+-----------------------------------+ 10 | | dd | dddd | dddddd | 11 | +---------------+------------+-----------------------------------+ 12 | -------------------------------------------------------------------------------- /test/title_rst.test: -------------------------------------------------------------------------------- 1 | ../table --title "now or never" --rst data1.txt 2 | -------------------------------------------------------------------------------- /test/title_too_long.ok: -------------------------------------------------------------------------------- 1 | ╒════════════════════════════════════════════════════════════════╕ 2 | │ this will never ever fit also if you do not like it now or nev │ 3 | ╞═══════════════╤════════════╤═══════════════════════════════════╡ 4 | │ aa │ aaaaaaaaaa │ aaaaaaa │ 5 | ├───────────────┼────────────┼───────────────────────────────────┤ 6 | │ bbbbbbbbbbbbb │ bbbb │ bbbbbbb │ 7 | │ cc │ cccccc │ ccccccccccccccccccccccccccccccccc │ 8 | │ dd │ dddd │ dddddd │ 9 | └───────────────┴────────────┴───────────────────────────────────┘ 10 | -------------------------------------------------------------------------------- /test/title_too_long.test: -------------------------------------------------------------------------------- 1 | ../table --title "this will never ever fit also if you do not like it now or never ever never" data1.txt 2 | --------------------------------------------------------------------------------