tableaux
CLI table + auxiliary TTY write utils like dim, bold, newline and arrow
install
npm install tableaux
Usage
writeFn
columnHeader
The columnHeader
is an object which can have the following possible properties:
name
(string), requiredsize
(number)align
(string), 'left', 'right' or 'center', default='left'color
(string or function),function(val, row) { return color; }
format
(function),function(val, row) { return newVal; }
Multiple column headers can be passed,
writeFn(...columnValues)
The returned value is a function, each argument corresponds to a column,
var write =
The writeFn
also has several convenience methods
writeFn.dim(str)
Output the string with the dim ANSI escape code
writeFn.bold(str)
Output the string with the bright ANSI escape code
writeFn.newline()
Write a newline character (\n
)
writeFn.spaces(n)
Write n
number of spaces
writeFn.arrow(leftPad = 3, rightPad = 1)
Output a ↳
character, specify leftPad
and rightPad
params
for padding around the arrow
Example
var tableaux = var write = write { write write isbns write}
License
MIT
Acknowledgements
- sponsored by nearForm