use console::{StyledObject, style};
use ryra_core::data::ServiceStatus;
pub fn list_status(status: &ServiceStatus, active: bool, width: usize) -> String {
let (raw, styled): (&str, StyledObject<String>) = match (status, active) {
(ServiceStatus::Installed, true) => {
let p = format!("{:<width$}", "running");
("running", style(p).green())
}
(ServiceStatus::Installed, false) => {
let p = format!("{:<width$}", "stopped");
("stopped", style(p).yellow())
}
(ServiceStatus::Orphan, _) => {
let p = format!("{:<width$}", "removed");
("removed", style(p).dim())
}
};
let _ = raw;
styled.to_string()
}
pub fn arrow() -> StyledObject<&'static str> {
style("→").yellow()
}
pub fn warning() -> StyledObject<&'static str> {
style("WARNING:").yellow().bold()
}
pub fn note() -> StyledObject<&'static str> {
style("NOTE:").cyan()
}
pub fn error_prefix(s: &'static str) -> StyledObject<&'static str> {
style(s).red().bold()
}
pub fn support_chip(s: &str) -> String {
style(s.to_string()).cyan().to_string()
}