use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum WhichError {
#[error("Command not found: {0}")]
NotFound(String),
}
pub trait WhichChecker {
fn find(&self, command: &str) -> Result<PathBuf, WhichError>;
}
pub struct DefaultWhichChecker;
impl WhichChecker for DefaultWhichChecker {
fn find(&self, command: &str) -> Result<PathBuf, WhichError> {
which::which(command).map_err(|_| WhichError::NotFound(command.to_string()))
}
}