elastic / elastic/cli

feat: honor NO_COLOR and keep pipe output parseable

Open
#635 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
41
Forks
24
Avg merge
1d 3h
Merged PRs (30d)
56

Description

We check TTY in a few places (`logo.ts` already honors `NO_COLOR`; `docs ask` disables the spinner off-TTY) but human tables always use Unicode box drawing (`src/output.ts` + cli-table3), and `elastic status` prints checkmarks. No `--no-color`. Piped human output is not a stable TSV.

Pre-1.0, do not add a pager. Do:

- Honor `NO_COLOR` and `FORCE_COLOR` everywhere we emit ANSI
- Add `--no-color` as a global alias for `NO_COLOR`
- When stdout is not a TTY and `--json` is absent, render tables as TSV (or fall back to JSON). Unicode borders and checkmarks are TTY-only
- Keep stdout = data, stderr = diagnostics (audit `docs` / `status` / extensions)

Relates to #623 (nested object rendering). This issue is the output contract, not that CAT bug.

Acceptance: `NO_COLOR=1 elastic status` has no ANSI and no checkmark glyphs. `elastic stack es cat indices | cat` is TSV or JSON, not a box table. Tests cover TTY and non-TTY.

Contributor guide

Open the contributing guide

Research direction

Start with src/output.ts, logo.ts, and the docs, status, and extensions output paths; inspect the existing cli-table3 and TTY handling. Trace where ANSI, Unicode borders, checkmarks, and stdout diagnostics are emitted, then add TTY and non-TTY tests. Done means NO_COLOR and --no-color suppress ANSI, piped human output is TSV or JSON, and stdout contains data only.

Written by the indexing model from the issue text.

Assessment

Tech stack
cli, typescript
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.