|
|
2 years ago | |
|---|---|---|
| .. | ||
| LICENSE | 2 years ago | |
| README.md | 2 years ago | |
| color.js | 2 years ago | |
| index.js | 2 years ago | |
| package.json | 2 years ago | |
| test.js | 2 years ago | |
cli-columnsColumnated lists for the CLI. Unicode and ANSI safe.
$ npm install --save cli-columns
const chalk = require('chalk');
const columns = require('.');
const values = [
'blue' + chalk.bgBlue('berry'),
'笔菠萝' + chalk.yellow('苹果笔'),
chalk.red('apple'), 'pomegranate',
'durian', chalk.green('star fruit'),
'パイナップル', 'apricot', 'banana',
'pineapple', chalk.bgRed.yellow('orange')
];
console.log(columns(values));
values {Array<String>} Array of strings to display.options {Object}
character {String} (default: ' ') Padding character.newline {String} (default: '\n') Newline character.padding {Number} (default: 2) Space between columns.sort {Boolean} (default: true) Whether to sort results.width {Number} (default: process.stdout.columns) Max width of list.Sorts and formats a list of values into columns suitable to display in a given width.
Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.
$ npm test
© Shannon Moeller me@shannonmoeller.com (shannonmoeller.com)
Licensed under MIT