JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 710715
  • Score
    100M100P100Q172657F
  • License MIT

Columnated lists for the CLI.

Package Exports

  • cli-columns

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-columns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cli-columns

NPM version Downloads Build Status Coverage Status Chat Tip

Columnated lists for the CLI. Unicode and ANSI safe.

Install

$ npm install --save cli-columns

Usage

var chalk = require('chalk');
var columns = require('cli-columns');

var values = [
    'foo', 'bar', 'baz',
    chalk.cyan('嶜憃撊') + ' 噾噿嚁',
    'blue' + chalk.bgBlue('berry'),
    chalk.red('apple'), 'pomegranate',
    'durian', chalk.green('star fruit'),
    'apricot', 'banana pineapple'
];

console.log(columns(values));
screenshot

API

columns(values [, options]): String

  • 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.

Contribute

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.

Test

$ npm test

© Shannon Moeller me@shannonmoeller.com (shannonmoeller.com)

Licensed under MIT