diff --git a/src/binstall.rs b/src/binstall.rs index 43707c0c..73c474c3 100644 --- a/src/binstall.rs +++ b/src/binstall.rs @@ -13,6 +13,7 @@ pub use install::*; pub struct Options { pub no_symlinks: bool, pub dry_run: bool, + pub force: bool, pub version: Option, pub manifest_path: Option, pub cli_overrides: PkgOverride, diff --git a/src/binstall/install.rs b/src/binstall/install.rs index 455c3961..21015333 100644 --- a/src/binstall/install.rs +++ b/src/binstall/install.rs @@ -47,7 +47,7 @@ pub async fn install( .ok_or_else(|| miette!("No viable targets found, try with `--targets`"))?; if !opts.dry_run { - install_from_source(package, target, jobserver_client, opts.quiet) + install_from_source(package, target, jobserver_client, opts.quiet, opts.force) .await .map(|_| None) } else { @@ -127,6 +127,7 @@ async fn install_from_source( target: &str, lazy_jobserver_client: LazyJobserverClient, quiet: bool, + force: bool, ) -> Result<()> { let jobserver_client = lazy_jobserver_client.get().await?; @@ -150,6 +151,10 @@ async fn install_from_source( cmd.arg("--quiet"); } + if force { + cmd.arg("--force"); + } + let mut child = cmd .spawn() .into_diagnostic() diff --git a/src/main.rs b/src/main.rs index 750a438d..da87fc49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -370,6 +370,7 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> { let binstall_opts = Arc::new(binstall::Options { no_symlinks: opts.no_symlinks, dry_run: opts.dry_run, + force: opts.force, version: opts.version_req.take(), manifest_path: opts.manifest_path.take(), cli_overrides,