# cli-list

> Break CLI lists into arrays

Latest version **1.0.0** (published 2024-12-06) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-12-06 |
| First published | 2016-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Jamen Marzonie |
| Maintainers | sboudrias, jamen |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2024-12-06
- 0.2.0 — 2016-08-18
- 0.1.8 — 2016-05-01
- 0.1.7 — 2016-05-01
- 0.1.6 — 2016-02-29
- 0.1.5 — 2016-02-29
- 0.1.4 — 2016-02-29
- 0.1.3 — 2016-02-27
- 0.1.2 — 2016-02-27
- 0.1.1 — 2016-02-26

## README

# cli-list
> Break CLI lists into arrays

[![build status][travis-status]][travis] ![downloads][downloads]

Given a "CLI list" like so:
```
foo bar, baz --qux, oof
```
We can expect `process.argv` to be something such as:
```javascript
['foo', 'bar,', 'baz', '--qux,', 'oof']
```
If we run this through the `cli-list` function we can split it into sub-arrays where the commas are:
```javascript
[['foo', 'bar'], ['baz', '--qux'], ['oof']]
```
Theses arrays maintain the `process.argv` style, so they can be used in parity with things like minimist.

## Installation
```shell
$ npm install --save cli-list
```

## Usage
```javascript
var list = require('cli-list');
var opts = list(process.argv.slice(2));
```

ES6 + Minimist:
```javascript
import list from 'cli-list';
import minimist from 'minimist';
const opts = list(process.argv.slice(2)).map(item => minimist(item));
```

## Examples
Given:
```
$ test foo --bar, baz, --qux
```
Expect:
```
[['foo', '--bar'], ['baz'], ['--qux']]
```

## Credits
| ![jamen][avatar] |
|:---:|
| [Jamen Marzonie][github] |

  [avatar]: https://avatars.githubusercontent.com/u/6251703?v=3&s=125
  [github]: https://github.com/jamen
  [travis-status]: https://travis-ci.org/jamen/cli-list.svg
  [travis]: https://travis-ci.org/jamen/cli-list
  [downloads]: https://img.shields.io/npm/dm/cli-list.svg

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