summaryrefslogtreecommitdiff
path: root/rola-cli/src/output/ansi_control.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-18 20:56:05 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-18 20:56:05 +0800
commit68daa10abfe3015beca966825d32cf67c9f5d5d7 (patch)
treec28f0470240e7cdc3748cee57ef74353514c47b7 /rola-cli/src/output/ansi_control.rs
parent669898193bebeadc975881bee496fe0239df76a0 (diff)
feat(bucket): implement bucket initialization and logging infrastructure
Add bucket init logic with directory structure creation and log macros for tracing
Diffstat (limited to 'rola-cli/src/output/ansi_control.rs')
-rw-r--r--rola-cli/src/output/ansi_control.rs32
1 files changed, 32 insertions, 0 deletions
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()
+}