Skip to content
reaatechREAATECH

@reaatech/cli

pending npm

Provides a CLI binary that transforms text piped via stdin into kebab-case, camelCase, or URL-safe slugs, or truncates it to a specified length. It acts as a command-line interface for string manipulation utilities defined in `@reaatech/core`.

@reaatech/cli

Thin CLI wrapper that pipes stdin through a chosen helper from @reaatech/core.

Installation

code
pnpm add @reaatech/cli

After installing globally or linking, the string-utils binary is available:

code
echo "Hello World" | string-utils --op kebab
# hello-world

Usage

code
string-utils --op <operation> [--max-length <n>] [--suffix <string>]

Reads from stdin, writes to stdout. Exits 0 on success, 1 on error.

Arguments

FlagRequiredDescription
--opYesOperation: kebab, camel, truncate, slugify
--max-lengthFor truncateNon-negative integer. Max output length including suffix.
--suffixNoSuffix to append on truncation (default ). Only valid with --op truncate.

Operations

kebab — convert stdin to kebab-case

code
echo "helloWorld" | string-utils --op kebab
# hello-world

camel — convert stdin to camelCase

code
echo "hello-world" | string-utils --op camel
# helloWorld

truncate — truncate stdin to maxLength, append suffix

code
echo "hello world" | string-utils --op truncate --max-length 5
# hello…
echo "abcdef" | string-utils --op truncate --max-length 3 --suffix "..."
# abc...

slugify — convert stdin to a URL-safe slug

code
echo "Hello World!" | string-utils --op slugify
# hello-world

Exit codes

CodeMeaning
0Success
1Error (unknown op, missing --op, missing --max-length for truncate, non-integer or negative --max-length, non-numeric --max-length)

Error output

All errors write to stderr with no prefix:

code
Error: --op is required
Error: --max-length is required for --op truncate
Error: --max-length must be a non-negative integer