cli-columns is a lightweight Node.js utility designed to format arrays of strings into neatly aligned, columnated lists suitable for command-line interfaces. It is particularly noted for its robust handling of both Unicode characters and ANSI escape codes (e.g., for colored text) by accurately calculating visible widths, preventing visual misalignment common in other simpler columnizers. The current stable version is 4.0.0, which notably addressed a ReDoS vulnerability in its upstream dependencies and updated its minimum Node.js requirement to version 10 or higher. While its release cadence may appear measured, the project prioritizes stability and precise rendering for CLI output. Key differentiators include customizable padding characters, column spacing, newline characters, optional sorting, and the ability to set a maximum output width, often defaulting to `process.stdout.columns`.
npm install cli-columnsVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `cli-columns` to format a list of strings, including those with Unicode and ANSI colors, into columns. It also shows how to customize width, sorting, and padding.
Upgrade Node.js to version 10 or higher, or explicitly install `cli-columns@3.x` if older Node.js versions are unavoidable (e.g., `npm install cli-columns@3`).
Upgrade to `cli-columns@4.0.0` or newer to ensure you have the patched dependencies. Run `npm install cli-columns@latest`.
Change the import statement to `import columns from 'cli-columns';` in your ES module file.
Use the correct default import syntax: `import columns from 'cli-columns';`.
Ensure the argument passed to `columns()` is an array where all elements are strings. For example: `columns(['string1', 'string2'])`.
No dependency data recorded yet.