use std::{
ffi::OsString,
path::{Path, PathBuf},
process::Command,
};
#[derive(Clone, Debug)]
pub struct Tool {
pub(crate) tool: PathBuf,
pub(crate) is_clang_cl: bool,
pub(crate) env: Vec<(OsString, OsString)>,
}
impl Tool {
pub fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.tool);
for (k, v) in self.env.iter() {
cmd.env(k, v);
}
cmd
}
pub fn is_clang_cl(&self) -> bool {
self.is_clang_cl
}
pub fn path(&self) -> &Path {
&self.tool
}
pub fn env(&self) -> impl IntoIterator<Item = &(OsString, OsString)> {
&self.env
}
}