Registry / http-networking / cli-list

cli-list

JSON →
library1.0.0jsnpmunverified

cli-list is a utility package designed to parse command-line argument lists, typically sourced from `process.argv`, into a structured array of arrays. It specializes in breaking down a single array of arguments, where items might be comma-separated, into sub-arrays at each comma delimiter. This maintains the "argv style" of the sub-arrays, making them suitable for direct consumption by other command-line argument parsers like `minimist`. The current stable version is 1.0.0, which was released recently and updated the codebase to modern JavaScript standards while strictly enforcing a minimum Node.js engine requirement of 18.0.0. The package has a focused scope, providing a clear solution for preprocessing CLI arguments that utilize comma-separated values, acting as an essential parsing layer before more complex option handling.

npm install cli-list
INSTALL
IMPORT
SIG · CLI-LIST
C
cli-list
http-networkingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

list
const list = require('cli-list');
import list from 'cli-list';
The package explicitly maintains CommonJS module format since v1.0.0. While `import` may work with bundlers or Node.js's CJS interop for default exports, `require` is the native and most reliable way to consume this package.
list (ESM usage)
import list from 'cli-list';
import { list } from 'cli-list';
When using ESM, `cli-list` is consumed as a default export. Ensure your environment or bundler correctly handles CommonJS default exports for ESM `import` statements.

Demonstrates how to parse a raw `process.argv` style array with `cli-list` and then further process each resulting sub-array using `minimist`.

import list from 'cli-list'; import minimist from 'minimist'; // minimist needs to be installed via `npm install minimist` // Simulate process.argv.slice(2) for a test case // In a real CLI, you'd use: const args = process.argv.slice(2); const rawCliArgs = ['foo', '--bar,', 'baz', '--qux', 'oof,value']; console.log('Original CLI arguments:', rawCliArgs); // Split the arguments into sub-arrays based on commas const parsedLists = list(rawCliArgs); console.log('cli-list parsed lists:', parsedLists); // Expected: [['foo', '--bar'], ['baz'], ['--qux', 'oof'], ['value']] // Process each sub-list using minimist const opts = parsedLists.map(item => minimist(item)); console.log('Minimist parsed options for each list:', opts); /* Expected Output (opts): [ { _: [ 'foo' ], bar: true }, { _: [ 'baz' ] }, { _: [ 'oof' ], qux: true }, { _: [ 'value' ] } ] */
Debug
Known issues
breakingVersion 1.0.0 and above enforce a minimum Node.js engine requirement of `>=18`. Older Node.js versions will fail to install or run the package.
fix
Upgrade your Node.js environment to version 18 or higher using tools like `nvm` or your system's package manager.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'cli-list'
Attempting to import `cli-list` using `import` syntax in a pure CommonJS environment, or using `require` in a pure ESM environment without proper interop configuration.
fix
For CommonJS projects, use `const list = require('cli-list');`. For ESM projects, ensure your `package.json` has `"type": "module"` and your bundler/Node.js version supports CJS-ESM interop for default exports, using `import list from 'cli-list';`.
npm ERR! code EUNSUPPORTEDENGINE npm ERR! Unsupported engine for cli-list@1.0.0: wanted: {"node": ">=18"} (current: v16.x.x)
Attempting to install or run `cli-list` version 1.0.0 or newer on a Node.js version older than 18.
fix
Upgrade your Node.js environment to version 18 or higher. Use `node --version` to check your current Node.js version.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
cli-list — npm install cli-list · libregistry