use std::path::Path;
#[cfg(target_os = "macos")]
pub(super) use super::launchd::{current, manual_remove, manual_set_up, remove, set_up, title};
#[cfg(target_os = "linux")]
pub(super) use super::systemd::{current, manual_remove, manual_set_up, remove, set_up, title};
#[cfg(windows)]
pub(super) use super::task::{current, manual_remove, manual_set_up, remove, set_up, title};
use crate::registered::same_path;
#[derive(Debug, Clone, PartialEq, Eq)]
pub(super) enum Found {
Missing,
Runs(String),
Unknown,
}
impl Found {
pub(super) fn starts(&self, allotd: &Path) -> bool {
matches!(self, Self::Runs(command) if same_path(command, allotd))
}
pub(super) fn replaced_note(&self, allotd: &Path, set_up: &str) -> String {
match self {
Self::Runs(other) if !same_path(other, allotd) => {
format!("{set_up}; it started {other} before")
}
_ => set_up.to_owned(),
}
}
}