mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-27 07:29:28 +02:00
23 lines
426 B
Rust
23 lines
426 B
Rust
use super::error::*;
|
|
use failure::ResultExt;
|
|
use std::path::PathBuf;
|
|
use std::process::Command;
|
|
use which::which;
|
|
|
|
#[derive(Debug)]
|
|
pub struct Tool {
|
|
exec: PathBuf,
|
|
}
|
|
|
|
impl Tool {
|
|
pub fn find(name: &'static str) -> Result<Self, Error> {
|
|
Ok(Self {
|
|
exec: which(name).context(ErrorKind::NoTool(name))?,
|
|
})
|
|
}
|
|
|
|
pub fn execute(&self) -> Command {
|
|
Command::new(&self.exec)
|
|
}
|
|
}
|