diff --git a/crates/radicle-term/src/io.rs b/crates/radicle-term/src/io.rs index 0fa1fb4b..6a50b7fb 100644 --- a/crates/radicle-term/src/io.rs +++ b/crates/radicle-term/src/io.rs @@ -46,6 +46,26 @@ pub static CONFIG: LazyLock = LazyLock::new(|| RenderConfig { ..RenderConfig::default_colored() }); +/// Target for paint operations. +/// +/// This tells a [`Spinner`] object where to paint to. +#[derive(Clone)] +pub enum PaintTarget { + Stdout, + Stderr, + Hidden, +} + +impl PaintTarget { + pub fn writer(&self) -> Box { + match self { + PaintTarget::Stdout => Box::new(io::stdout()), + PaintTarget::Stderr => Box::new(io::stderr()), + PaintTarget::Hidden => Box::new(io::sink()), + } + } +} + #[macro_export] macro_rules! info { ($writer:expr; $($arg:tt)*) => ({