diff options
| author | tingerrr <me@tinger.dev> | 2024-01-02 10:03:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-02 09:03:01 +0000 |
| commit | 4bf16d7acb1407325d95e24aa237af04c341ee2c (patch) | |
| tree | 77d133838de3289d53af7b365831098519f30ca5 /crates/typst-cli/src/main.rs | |
| parent | 79a41aedbe596d0e357014ccf6b2e78a06cc74a4 (diff) | |
Add a `--color` flag (#3060)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-cli/src/main.rs')
| -rw-r--r-- | crates/typst-cli/src/main.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/typst-cli/src/main.rs b/crates/typst-cli/src/main.rs index 15a758af..8917adc3 100644 --- a/crates/typst-cli/src/main.rs +++ b/crates/typst-cli/src/main.rs @@ -68,10 +68,16 @@ fn print_error(msg: &str) -> io::Result<()> { /// Get stderr with color support if desirable. fn color_stream() -> termcolor::StandardStream { - termcolor::StandardStream::stderr(if std::io::stderr().is_terminal() { - ColorChoice::Auto - } else { - ColorChoice::Never + termcolor::StandardStream::stderr(match ARGS.color { + clap::ColorChoice::Auto => { + if std::io::stderr().is_terminal() { + ColorChoice::Auto + } else { + ColorChoice::Never + } + } + clap::ColorChoice::Always => ColorChoice::Always, + clap::ColorChoice::Never => ColorChoice::Never, }) } |
