Simple CLI table for simple people
npm i cli-simple-table
import SimpleTable from 'cli-simple-table'
import chalk from 'chalk'
const table = new SimpleTable()
table.header('Name', 'Emoji')
table.row(chalk.red('Squid'), '๐ฆ')
table.row(chalk.green('Frog'), '๐ธ')
table.row(chalk.yellow('Tiger'), '๐ฏ')
table.row(chalk.blue('Whale'), '๐ณ')
table.row(chalk.magenta('Unicorn'), '๐ฆ')
table.row(chalk.cyan('Dolphin'), '๐ฌ')
table.row(chalk.white('Panda'), '๐ผ')
console.log(table.toString())
const table = new SimpleTable()
table.header(
'Name',
{
text: 'Age',
align: 'right'
}
)
table.row('Steve', 26)
console.log(table.toString())
const table = new SimpleTable()
table.header(
{
text: 'Long text',
maxWidth: 25
},
{
text: 'Long long text',
maxWidth: 25
}
)
table.row('Truncates really really long text', chalk.magenta('Colored long long text too'))
console.log(table.toString())
-
columnPadding
<Number>
(10
) - Number of characters to pad the column content with -
headerSeparator
<Number>
(1
) - Number of lines that separate the header from the table body