cli-table-redemption

raw JSON →
1.0.1 verified Sat Apr 25 auth: no javascript maintenance

CLI Table Redemption is a fork maintained by Keymetrics to improve PM2's CLI table rendering. It generates beautiful unicode-aided tables for command-line Node.js scripts. Features customizable characters, chalk-based header styling, column width control, text truncation, alignment (left, right, center), and padding. Latest version 2.0.1 (2019-12-09) is mostly compatible with original cli-table but adds bug fixes and maintenance. It requires Node >= 0.12 and is commonly used with PM2 or other Node CLI tools. Few updates recently, but it's stable for terminal table output.

error Cannot find module 'cli-table-redemption'
cause Package not installed or wrong dependency name used.
fix
Run: npm install cli-table-redemption
error TypeError: table.push is not a function
cause Using table incorrectly; table is an instance of Table, but common mistake is to call push on the class itself.
fix
Correct usage: var table = new Table(); table.push(['val']);
error Error: Cannot read properties of undefined (reading 'length')
cause When constructing table without head or colWidths, internal code may try to read head.length on undefined.
fix
Always provide head and colWidths if you intend to have headers, or omit head entirely for key-value tables.
gotcha Package is a fork of the original cli-table and may have slight behavioral differences. Ensure you are using cli-table-redemption if your project depends on PM2's behavior.
fix Check package.json for dependency name: 'cli-table-redemption' not 'cli-table'.
deprecated The original cli-table is unmaintained; cli-table-redemption is maintained by Keymetrics but also sees infrequent updates.
fix Use cli-table3 or cli-table2 for more active maintenance and TypeScript support.
breaking Some users have reported that colWidths must be explicitly set; otherwise columns may be too narrow and text truncation occurs unexpectedly.
fix Always provide colWidths in the options object to avoid auto-sizing issues.
npm install cli-table-redemption
yarn add cli-table-redemption
pnpm add cli-table-redemption

Creates a table with custom double-line border characters, header row, three columns, and three rows, then prints it.

var Table = require('cli-table-redemption');
var table = new Table({
  head: ['Name', 'Age', 'City'],
  colWidths: [20, 10, 20],
  chars: {
    'top': '═', 'top-mid': '╤', 'top-left': '╔', 'top-right': '╗',
    'bottom': '═', 'bottom-mid': '╧', 'bottom-left': '╚', 'bottom-right': '╝',
    'left': '║', 'left-mid': '╟', 'mid': '─', 'mid-mid': '┼',
    'right': '║', 'right-mid': '╢', 'middle': '│'
  },
  style: { 'padding-left': 1, 'padding-right': 1 }
});
table.push(
  ['Alice', 30, 'New York'],
  ['Bob', 25, 'San Francisco'],
  ['Charlie', 35, 'Chicago']
);
console.log(table.toString());