use IsTerminal;
use ;
use crateerrors;
/// Width of the progress bar in terminal columns.
const BAR_WIDTH: usize = 40;
/// Create a progress bar with the standard rsconstruct style.
///
/// Returns a hidden bar when:
/// - `hidden` is true (verbose mode, JSON mode, or quiet mode), OR
/// - stdout is not a terminal (piped or redirected).
///
/// The stdout-TTY check matters because a bar drawn to stderr while stdout
/// is being captured by `| cat`, `| less`, or a CI log pipeline produces
/// noise: ANSI escape codes interleave with the captured text and the user
/// isn't watching live anyway. indicatif only auto-hides when *its own*
/// channel (stderr) is non-TTY; we additionally honor stdout's interactivity
/// because that's the channel the user is actually consuming.