Registry / devops / echo-cli

echo-cli

JSON →
library2.0.0jsnpmunverified

echo-cli is a utility designed to address inconsistencies in command-line output across different operating systems, particularly focusing on the limitations of Windows CMD regarding escape sequences and newline characters. It provides a cross-platform solution for outputting text to the terminal, supporting all standard JavaScript escape sequences. This makes it particularly useful for `npm scripts` and other automation tasks where consistent terminal output, including formatted text and newlines, is crucial regardless of the underlying shell. The current stable version is 2.0.0, released after dropping a dependency on `meow`. The package does not have a defined public release cadence but is actively maintained to ensure its core functionality.

npm install echo-cli
INSTALL
IMPORT
SIG · ECHO-CLI
E
echo-cli
devopsjavascriptv2.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.

echo-cli command
echo-cli "Hello, world!\nThis is a new line."
import echoCli from 'echo-cli';
This package is a command-line interface (CLI) tool and does not expose a programmatic API for direct import into JavaScript/TypeScript applications. Its functionality is accessed by executing the `echo-cli` command in a shell or within `npm scripts`.
Type (none)
// No direct type imports as this is a CLI.
import type { EchoOptions } from 'echo-cli';
As `echo-cli` is primarily a CLI without a programmatic API, there are no specific types or interfaces intended for programmatic import or use within TypeScript code.
echo-cli (CommonJS)
/* Use via child_process.exec or similar for programmatic execution */
const echoCli = require('echo-cli');
Attempting to `require('echo-cli')` will likely return a reference to the CLI executable's entry point, not a library function. For programmatic execution in Node.js, use `child_process.exec` or `spawn` to run the command.

Demonstrates `echo-cli` usage within `package.json` scripts to output formatted messages with escape sequences before and after build tasks, ensuring consistent output across platforms.

{ "name": "my-project", "version": "1.0.0", "scripts": { "prebuild": "echo-cli 'Starting build process...\n'", "build": "npm run prebuild && echo-cli 'Compiling code...\t(This might take a moment)' && sleep 1 && echo-cli '\nBuild complete! 🎉'", "test": "echo-cli 'Running tests...\n' && npm test" }, "devDependencies": { "echo-cli": "^2.0.0" } }
echo-cli --version
Debug
Known issues
breakingVersion 2.0.0 removed the `meow` dependency. While this was an internal change, it could potentially lead to minor, non-functional output differences in edge cases due to the change in input parsing logic.
fix
No direct fix needed for consumers; simply update to v2.0.0. Review any scripts that rely on highly specific output formatting if issues arise.
affects: >=2.0.0
gotchaWhen using escape sequences (e.g., `\n`, `\t`) in shell commands, it is crucial to wrap the entire string in quotes (preferably double quotes) to prevent the shell from interpreting the escape sequences itself before `echo-cli` can process them.
fix
Always quote strings containing escape sequences: `echo-cli "Hello,\nworld!"` instead of `echo-cli Hello,\nworld!`
affects: >=1.0.0
gotchaThe primary purpose of `echo-cli` is to provide consistent output on Windows CMD, which notoriously lacks support for standard escape sequences and handles newlines differently than Bash. For non-Windows environments, the native `echo` command often suffices, but `echo-cli` ensures cross-platform consistency.
fix
Utilize `echo-cli` specifically in environments or scripts where cross-platform consistency of escape sequences and newline handling is paramount, especially when targeting Windows CMD.
affects: >=1.0.0
Errors
Common errors & fixes
echo-cli: command not found
The `echo-cli` command-line tool is not installed globally or is not accessible in the current shell's PATH.
fix
To use it globally: `npm install -g echo-cli`. To use it as a `devDependency` in `npm scripts` (recommended): `npm install --save-dev echo-cli`. Ensure your `package.json` scripts reference it correctly.
Escape sequences like \n or \t are printed literally, not interpreted.
The shell is interpreting the escape sequence before `echo-cli` receives the argument, or `echo-cli` isn't correctly parsing it.
fix
Ensure the text containing escape sequences is enclosed in quotes, e.g., `echo-cli "Line 1\nLine 2"`. This prevents the shell from processing them prematurely.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
echo-cli — npm install echo-cli · libregistry