cli: colorize nx --help output using owo-colors (behind a --color flag) - #94
cli: colorize nx --help output using owo-colors (behind a --color flag) #94lntutor wants to merge 1 commit into
Conversation
|
Current head |
GianIac
left a comment
There was a problem hiding this comment.
Thanks for the PR, feature works and matches #83.
A few things before merge:
-
PR has conflicts with
main(likely from #89 touchingmain()/real_main()). Please rebase and make sureCli::Completionsis still intercepted before the Tokio runtime is built. -
requested_color()silently falls back toAutoon invalid values (--color=foobar), while clap will error out on the same input right after. Either accept onlyauto|always|neverand let clap handle the rest, or drop the pre-parser and read the value from clap matches. -
Replace
.expect(...)onCli::from_arg_matcheswith?—real_mainreturnsResult, no need to panic here.
Nits (optional)
stdout_supports_color()allocates aStringjust to search for\x1b.std::io::IsTerminalorsupports_color::on(...)would be cleaner.
Once rebased and the two changes above are in, happy to merge.
Summary
--color <auto|always|never>option for CLI helpowo-colorsterminal detection and a conservative cyan/green/yellow help paletteNO_COLORprecedence over explicit color settingsVerification
/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 warningsgit diff --checkNO_COLOR=1modesCloses #83