cli-table / 0.3.1 last updated a year ago created on Jan 4th 2011
Install
npm install --save cli-table
Clone
git clone git@github.com:Automattic/cli-table.git
maintainers
versions
| 0.3.1 | a year ago | rauchg |
| 0.3.0 | 2 years ago | rauchg |
| 0.2.0 | 3 years ago | rauchg |
| 0.0.2 | 4 years ago | rauchg |
readme
CLI Table

This utility allows you to render unicode-aided tables on the command line from your node.js scripts.

Features
- Customizable characters that constitute the table.
- Color/background styling in the header through colors.js
- Column width customization
- Text truncation based on predefined widths
- Text alignment (left, right, center)
- Padding (left, right)
- Easy-to-use API
Installation
How to use
Horizontal Tables
Vertical Tables
Cross Tables
Cross tables are very similar to vertical tables, with two key differences:
- They require a
headsetting when instantiated that has an empty string as the first header - The individual rows take the general form of { "Header": ["Row", "Values"] }
Custom styles
The chars property controls how the table is drawn:
Empty decoration lines will be skipped, to avoid vertical separator rows just set the 'mid', 'left-mid', 'mid-mid', 'right-mid' to the empty string:
By setting all chars to empty with the exception of 'middle' being set to a single space and by setting padding to zero, it's possible to get the most compact layout with no decorations:
Running tests
Clone the repository with all its submodules and run:
Credits
- Guillermo Rauch <guillermo@learnboost.com> (Guille)
License
(The MIT License)
Copyright (c) 2010 LearnBoost <dev@learnboost.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.