use std::path::{Path, PathBuf};
use anyhow::{Result, bail};
use super::{Job, Manager};
use crate::home::{Home, user_home};
pub const DISPLAY: &str = "user service";
pub fn manager(_home: &Home, job: &'static Job) -> Result<Box<dyn Manager>> {
let _ = user_home()?;
Ok(Box::new(Unsupported { job }))
}
struct Unsupported {
job: &'static Job,
}
impl Manager for Unsupported {
fn install(&self, _binary: &Path, _moat_home: &Path) -> Result<PathBuf> {
bail!(
"`{}` is not supported on {} yet; run `openmoat {}` in a terminal to keep {} up",
self.job.install,
std::env::consts::OS,
self.job.terminal,
self.job.noun
)
}
fn uninstall(&self) -> Result<Option<PathBuf>> {
Ok(None)
}
}