with fuzzy-clone

This commit is contained in:
2022-12-18 01:41:12 +01:00
parent 66105004e0
commit 27f63cc1f9
9 changed files with 298 additions and 22 deletions

View File

@@ -1,21 +1,31 @@
use std::io::Write;
pub fn run(args: &[&str]) -> eyre::Result<()> {
let output = std::process::Command::new(
pub struct RunOptions {
pub path: std::path::PathBuf,
}
pub fn run(args: &[&str], opts: Option<RunOptions>) -> eyre::Result<()> {
let mut cmd = std::process::Command::new(
args.first()
.ok_or(eyre::anyhow!("could not find first arg"))?,
)
.args(
args.to_vec()
.into_iter()
.skip(1)
.collect::<Vec<&str>>()
.as_slice(),
)
.stdout(std::process::Stdio::inherit())
.stderr(std::process::Stdio::inherit())
.stdin(std::process::Stdio::inherit())
.output();
);
if let Some(opts) = opts {
cmd.current_dir(opts.path);
}
let output = cmd
.args(
args.to_vec()
.into_iter()
.skip(1)
.collect::<Vec<&str>>()
.as_slice(),
)
.stdout(std::process::Stdio::inherit())
.stderr(std::process::Stdio::inherit())
.stdin(std::process::Stdio::inherit())
.output();
match output {
Ok(o) => {