use std::{
borrow::Cow,
collections::BTreeMap,
fmt,
};
pub use self::swiftbar::SwiftBar;
pub mod swiftbar;
#[derive(Debug, Clone, Copy)]
pub enum Flavor {
BitBar,
SwiftBar(SwiftBar),
}
impl Flavor {
pub fn check() -> Flavor {
if let Some(swiftbar) = SwiftBar::check() {
Flavor::SwiftBar(swiftbar)
} else {
Flavor::BitBar
}
}
}
impl fmt::Display for Flavor {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Flavor::SwiftBar(_) => write!(f, "SwiftBar"),
Flavor::BitBar => write!(f, "BitBar"),
}
}
}
#[derive(Debug)]
#[allow(missing_docs)]
pub enum Attrs {
SwiftBar(swiftbar::Attrs),
}
impl Attrs {
pub(crate) fn render<'a>(&'a self, rendered_params: &mut BTreeMap<Cow<'a, str>, Cow<'a, str>>) {
match self {
Attrs::SwiftBar(params) => params.render(rendered_params),
}
}
}