# cli-columns

> Columnated lists for the CLI.

Latest version **4.0.0** (published 2021-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install cli-columns
pnpm add cli-columns
yarn add cli-columns
bun add cli-columns
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-09-23 |
| First published | 2016-02-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 2 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37 |
| Author | Shannon Moeller |
| Maintainers | shannonmoeller |
| Keywords | ansi, cli, column, columnate, columns, grid, list, log, ls, row, rows, unicode, unix |

## Links

- npm: https://www.npmjs.com/package/cli-columns
- Repository: https://github.com/shannonmoeller/cli-columns
- Homepage: https://github.com/shannonmoeller/cli-columns#readme
- Issues: https://github.com/shannonmoeller/cli-columns/issues
- npm.io page: https://npm.io/package/cli-columns

## Dependencies (2)

- [strip-ansi](https://npm.io/package/strip-ansi.md) ^6.0.1
- [string-width](https://npm.io/package/string-width.md) ^4.2.3

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2021-09-23
- 3.1.2 — 2017-07-27
- 3.1.1 — 2017-06-14
- 3.1.0 — 2017-06-14
- 3.0.0 — 2017-03-02
- 2.0.2 — 2017-02-07
- 2.0.1 — 2017-02-07
- 2.0.0 — 2017-02-07
- 1.1.0 — 2017-02-07
- 1.0.6 — 2016-02-22
- 1.0.5 — 2016-02-14
- 1.0.4 — 2016-02-14
- 1.0.3 — 2016-02-14
- 1.0.2 — 2016-02-14
- 1.0.1 — 2016-02-13
- … 1 more at https://npm.io/package/cli-columns/versions

## README

# `cli-columns`

[![NPM version][npm-img]][npm-url] [![Downloads][downloads-img]][npm-url]

Columnated lists for the CLI. Unicode and ANSI safe.

## Install

    $ npm install --save cli-columns

## Usage

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

<img alt="screenshot" src="https://user-images.githubusercontent.com/155164/28672800-bd415c86-72ae-11e7-855c-6f6aa108921b.png">

## 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](http://shannonmoeller.com)

[downloads-img]: http://img.shields.io/npm/dm/cli-columns.svg?style=flat-square
[npm-img]:       http://img.shields.io/npm/v/cli-columns.svg?style=flat-square
[npm-url]:       https://npmjs.org/package/cli-columns

---
_Source: https://npm.io/package/cli-columns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
