cli-columns

WebJar for cli-columns

License

License

MIT
Categories

Categories

CLI User Interface
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

cli-columns
Last Version

Last Version

3.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

cli-columns
WebJar for cli-columns
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/shannonmoeller/cli-columns

Download cli-columns

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/cli-columns/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>cli-columns</artifactId>
    <version>3.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/cli-columns/
implementation 'org.webjars.npm:cli-columns:3.1.2'
// https://jarcasting.com/artifacts/org.webjars.npm/cli-columns/
implementation ("org.webjars.npm:cli-columns:3.1.2")
'org.webjars.npm:cli-columns:jar:3.1.2'
<dependency org="org.webjars.npm" name="cli-columns" rev="3.1.2">
  <artifact name="cli-columns" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='cli-columns', version='3.1.2')
)
libraryDependencies += "org.webjars.npm" % "cli-columns" % "3.1.2"
[org.webjars.npm/cli-columns "3.1.2"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : string-width jar [2.0.0,3)
org.webjars.npm : strip-ansi jar [3.0.1,4)

Project Modules

There are no modules declared in this project.

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

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

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));

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

MIT © Shannon Moeller

Versions

Version
3.1.2