Expand description
Colour, and the “did you mean” a refusal needs to be useful.
Terminal styling for the parts of choir a person reads (D58).
Two rules hold this together, and they are what make colour safe in a tool whose other half is an agent:
- Data goes to stdout, unstyled, always. Every command that answers with JSON answers with exactly the bytes the node sent. Nothing in here is ever applied to that stream, so a pipeline sees the same thing whether or not a terminal is attached.
- Diagnostics go to stderr, styled only when a person is looking.
A person is looking when stderr is a terminal,
NO_COLORis unset, andTERMis notdumb.
Hand-rolled rather than owo-colors or console for the reason the
rest of the workspace hand-rolls: this is four escape sequences and a
predicate, and the two dependencies it would replace pull in
terminal-detection stacks whose behaviour we would then have to test
anyway.
§Examples
let plain = choir_cli::style::Style::plain();
assert_eq!(plain.bold("choir"), "choir");Structs§
- Style
- Whether styled output is wanted, and the sequences for it.