-
Notifications
You must be signed in to change notification settings - Fork 277
Closed
Description
Hello! This is a follow up to #86:
It seems that the default implementation draws to stderr, but whether the output is colorized is dependent on whether stdout is a tty, so if you do something like
foo > log, you get progress bars, but they're uncolored.
... which is a bit surprising for programs that intend their stdout to be piped but also use stderr for progress reporting. Right now I'm manually doing a set_colors_enabled(colors_enabled_stderr()) to convince indicatif to print colors.
I'm wondering if you'd be interested in a PR to make it configurable for ProgressStyle, now that console has features like for_stderr for differentiating color support on stdout vs. stderr.
How I imagine this to work:
- Have a
ProgressStyle::for_stderr()that explicitly sets color detection for itsTemplateParts; this could be a public API or justpub(crate); - Within
ProgressBar::set_style(), implicitly callProgressStyle::for_stderr()based on whether the bar'sProgressDrawTargetisTermTarget::Stderr(I'm not sure if doing this makes sense for other types of target though)
Thank you for this crate!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels