#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum ItemKind {
Runtime,
Service,
Watcher,
Recipe,
Script,
}
impl ItemKind {
pub fn glyph(self) -> &'static str {
match self {
ItemKind::Runtime | ItemKind::Service => "●",
ItemKind::Watcher => "◇",
ItemKind::Recipe | ItemKind::Script => "▸",
}
}
pub fn label(self) -> &'static str {
match self {
ItemKind::Runtime => "runtime",
ItemKind::Service => "service",
ItemKind::Watcher => "watcher",
ItemKind::Recipe => "recipe",
ItemKind::Script => "script",
}
}
pub fn is_launchable(self) -> bool {
matches!(self, ItemKind::Recipe | ItemKind::Script)
}
}
#[derive(Debug, Clone)]
pub struct Item {
pub name: String,
pub kind: ItemKind,
}