use crate::app::session_control::Action;
const WATCH: &str = "watch";
const UNWATCH: &str = "unwatch";
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum ServedTool {
Core(Action),
Watch,
Unwatch,
}
impl ServedTool {
pub(crate) fn from_name(name: &str) -> Option<Self> {
match name {
WATCH => Some(Self::Watch),
UNWATCH => Some(Self::Unwatch),
_ => Action::from_name(name).map(Self::Core),
}
}
pub(crate) fn name(self) -> &'static str {
match self {
Self::Core(action) => action.name(),
Self::Watch => WATCH,
Self::Unwatch => UNWATCH,
}
}
}