feat: Color output in terminal if running in TTY

This commit is contained in:
Gerald Pinder 2024-08-30 23:18:20 -04:00
parent 54c35a870f
commit 74d99f2b17
7 changed files with 58 additions and 3 deletions

View file

@ -4,6 +4,7 @@ use blue_build_recipe::Recipe;
use blue_build_utils::constants::{
CONFIG_PATH, CONTAINERFILES_PATH, CONTAINER_FILE, COSIGN_PUB_PATH, FILES_PATH,
};
use colored::control::ShouldColorize;
use log::{debug, error, trace, warn};
use typed_builder::TypedBuilder;
use uuid::Uuid;
@ -145,6 +146,10 @@ fn config_dir_exists() -> bool {
exists
}
fn should_color() -> bool {
ShouldColorize::from_env().should_colorize()
}
mod filters {
#[allow(clippy::unnecessary_wraps)]
pub fn replace<T: std::fmt::Display>(input: T, from: char, to: &str) -> rinja::Result<String> {