gvc 0.2.0

CLI manager for Gradle version catalogs—check, list, update, and add dependencies with automatic version aliases
use std::sync::atomic::{AtomicBool, Ordering};

static VERBOSE: AtomicBool = AtomicBool::new(false);

pub fn init(cli_verbose: bool) {
    VERBOSE.store(
        cli_verbose || std::env::var("GVC_VERBOSE").is_ok(),
        Ordering::Relaxed,
    );
}

pub fn is_enabled() -> bool {
    VERBOSE.load(Ordering::Relaxed)
}

pub fn log(message: impl AsRef<str>) {
    if is_enabled() {
        eprintln!("[VERBOSE] {}", message.as_ref());
    }
}