Skip to content

Commit

Permalink
Add conditional for color settings in error reporting via override, d…
Browse files Browse the repository at this point in the history
…isable on windows per default
  • Loading branch information
FlareFlo committed Oct 25, 2023
1 parent d1f03db commit 731d76d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,25 @@ pub const GIT_TAG: &str = env!("GIT_TAG");

fn main() -> Result<()> {
env::set_var("RUST_BACKTRACE", "1");
color_eyre::install()?;

let enable_color = if let Ok(force_color) = env::var("FORCE_SET_COLOR") {
force_color.parse::<bool>()
.expect("FORCE_COLOR was not 'false' or 'true'")
} else {
if cfg!(windows) {
false
} else {
true
}
};

if enable_color {
color_eyre::install()?;
} else {
color_eyre::config::HookBuilder::new()
.theme(color_eyre::config::Theme::new())
.install()?;
}

let command = build_command_structure().get_matches();
branch_subcommands(command)?;
Expand Down

0 comments on commit 731d76d

Please sign in to comment.