use std::path::PathBuf;
use super::{ProcessRunner, Runner, RunnerKind};
pub type RunnerCommand = super::RunnerCommand;
pub type RunnerExecution = super::RunnerExecution;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AbstractRunner {
inner: ProcessRunner,
}
impl AbstractRunner {
pub fn new(kind: RunnerKind) -> Self {
Self {
inner: ProcessRunner::new(kind),
}
}
pub fn with_binary(kind: RunnerKind, binary: impl Into<String>) -> Self {
Self {
inner: ProcessRunner::with_binary(kind, binary),
}
}
pub fn inner(&self) -> &ProcessRunner {
&self.inner
}
pub fn into_inner(self) -> ProcessRunner {
self.inner
}
}
impl Runner for AbstractRunner {
fn kind(&self) -> RunnerKind {
self.inner.kind()
}
fn binary(&self) -> &str {
self.inner.binary()
}
fn prefix_args(&self) -> &[String] {
self.inner.prefix_args()
}
}
pub fn describe(
runner: &impl Runner,
command: impl Into<String>,
collect: bool,
cwd: Option<PathBuf>,
) -> RunnerCommand {
runner.describe(command, collect, cwd)
}