From 68daa10abfe3015beca966825d32cf67c9f5d5d7 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 18 Jun 2026 20:56:05 +0800 Subject: feat(bucket): implement bucket initialization and logging infrastructure Add bucket init logic with directory structure creation and log macros for tracing --- rola-cli/src/output/ansi_control.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 rola-cli/src/output/ansi_control.rs (limited to 'rola-cli/src/output/ansi_control.rs') diff --git a/rola-cli/src/output/ansi_control.rs b/rola-cli/src/output/ansi_control.rs new file mode 100644 index 0000000..5db8c2a --- /dev/null +++ b/rola-cli/src/output/ansi_control.rs @@ -0,0 +1,32 @@ +use std::sync::atomic::{AtomicBool, Ordering}; + +mod colorize_wrapper; +pub use colorize_wrapper::*; + +/// Global flag controlling whether ANSI color output is enabled. +static ANSI_ENABLED: AtomicBool = AtomicBool::new(true); + +/// Enable ANSI color codes in output. +pub fn enable_ansi() { + ANSI_ENABLED.store(true, Ordering::Relaxed); +} + +/// Disable ANSI color codes in output. +pub fn disable_ansi() { + ANSI_ENABLED.store(false, Ordering::Relaxed); +} + +/// Set ANSI color output to the specified state (`true` to enable, `false` to disable). +pub fn set_ansi(enabled: bool) { + ANSI_ENABLED.store(enabled, Ordering::Relaxed); +} + +/// Check whether ANSI color output is currently enabled. +pub fn is_ansi_enabled() -> bool { + ANSI_ENABLED.load(Ordering::Relaxed) +} + +/// Returns `true` if ANSI is enabled, `false` otherwise. +pub fn is_enabled() -> bool { + is_ansi_enabled() +} -- cgit