monochromium 0.4.2

A fast, local-first CLI note-taking app for developers
pub enum CommandOutput {
    Text(String),
    Lines(Vec<String>),
    Raw(String),
}

impl CommandOutput {
    pub fn as_text(&self) -> String {
        match self {
            Self::Text(text) => text.clone(),
            Self::Lines(lines) => lines.join("\n"),
            Self::Raw(text) => text.clone(),
        }
    }

    pub fn print(&self) {
        match self {
            Self::Text(text) => println!("{text}"),
            Self::Lines(lines) => {
                for line in lines {
                    println!("{line}");
                }
            }
            Self::Raw(text) => print!("{text}"),
        }
    }
}