Skip to content

cli: colorize nx --help output using owo-colors (behind a --color flag) - #94

Open
lntutor wants to merge 1 commit into
GianIac:mainfrom
lntutor:feat/color-help-83
Open

cli: colorize nx --help output using owo-colors (behind a --color flag) #94
lntutor wants to merge 1 commit into
GianIac:mainfrom
lntutor:feat/color-help-83

Conversation

@lntutor

@lntutor lntutor commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a global --color <auto|always|never> option for CLI help
  • use owo-colors terminal detection and a conservative cyan/green/yellow help palette
  • keep piped output plain by default and give NO_COLOR precedence over explicit color settings
  • cover color policy, flag parsing, and ANSI/plain rendering with tests

Verification

  • /Users/loi/.cargo/bin/cargo test -p nx-cli
  • /Users/loi/.cargo/bin/cargo fmt --all -- --check
  • /Users/loi/.cargo/bin/cargo clippy -p nx-cli --all-targets -- -D warnings
  • git diff --check
  • binary checks for piped auto, never, always, and NO_COLOR=1 modes

Closes #83

@lntutor

lntutor commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Current head f12a73d88af24f7f422c90dea3876c53baebb231 is mergeable and the visible CI surface on this exact SHA is fully green: cross-platform Check, Clippy, and Test jobs on Ubuntu, macOS, and Windows; Format; Build WASM Examples; CLI Multi-process Smoke; Benchmark Comparator Tests; Ubuntu Profiling Artifacts; Benchmark Regression Gate; and the aggregate CI Success check all completed successfully. There are no review threads or review-body comments open on the current PR state, so if this colorized-help change still matches the intended direction, it looks ready for maintainer review/merge when convenient.

@GianIac GianIac changed the title feat(cli): colorize help output cli: colorize nx --help output using owo-colors (behind a --color flag) Aug 11, 2026

@GianIac GianIac left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, feature works and matches #83.

A few things before merge:

  • PR has conflicts with main (likely from #89 touching main() / real_main()). Please rebase and make sure Cli::Completions is still intercepted before the Tokio runtime is built.

  • requested_color() silently falls back to Auto on invalid values (--color=foobar), while clap will error out on the same input right after. Either accept only auto|always|never and let clap handle the rest, or drop the pre-parser and read the value from clap matches.

  • Replace .expect(...) on Cli::from_arg_matches with ?real_main returns Result, no need to panic here.

Nits (optional)

  • stdout_supports_color() allocates a String just to search for \x1b. std::io::IsTerminal or supports_color::on(...) would be cleaner.

Once rebased and the two changes above are in, happy to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: colorize nx --help output using owo-colors (behind a --color flag)

2 participants