pub struct Icons {
pub running: &'static str,
pub done: &'static str,
pub planned: &'static str,
pub failed: &'static str,
pub download: &'static str,
pub upload: &'static str,
pub clock: &'static str,
pub estimate: &'static str,
pub summary: &'static str,
}
pub static UNICODE: Icons = Icons {
running: "⏵",
done: "✔",
planned: "⏸",
failed: "✗",
download: "↓",
upload: "↑",
clock: "⏱",
estimate: "∅",
summary: "∑",
};
pub static NERD: Icons = Icons {
running: "\u{f04b}", done: "\u{f00c}", planned: "\u{f04c}", failed: "\u{f071}", download: "\u{f063}", upload: "\u{f062}", clock: "\u{f1da}", estimate: "\u{f252}", summary: "\u{f04a0}", };
pub fn detect() -> &'static Icons {
if let Ok(v) = std::env::var("NERD_FONTS") {
match v.trim() {
"1" | "true" | "yes" => return &NERD,
"0" | "false" | "no" => return &UNICODE,
_ => {},
}
}
let vars: Vec<(String, String)> = std::env::vars().collect();
match has_nerd_font::detect(&vars).detected {
Some(true) => &NERD,
_ => &UNICODE,
}
}