idt/installers/
harper_ls.rs

1use std::path::Path;
2
3use crate::Installer;
4
5pub struct HarperLs<'a> {
6    pub bin_dir: &'a Path,
7}
8
9impl Installer for HarperLs<'_> {
10    fn bin_name(&self) -> &'static str {
11        "harper-ls"
12    }
13
14    fn install(&self) -> color_eyre::Result<()> {
15        // Installing with `cargo` because I like it this way
16        ytil_cmd::silent_cmd("cargo")
17            .args([
18                "install",
19                self.bin_name(),
20                "--force",
21                "--root",
22                // `--root` automatically append `bin` 🥲
23                self.bin_dir.to_string_lossy().trim_end_matches("bin"),
24            ])
25            .status()?;
26
27        ytil_sys::file::chmod_x(self.bin_dir.join(self.bin_name()))?;
28
29        Ok(())
30    }
31}