mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 05:28:42 +00:00
Pass --force
to cargo-install
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
4b79abeedc
commit
34f714c64f
3 changed files with 8 additions and 1 deletions
|
@ -13,6 +13,7 @@ pub use install::*;
|
|||
pub struct Options {
|
||||
pub no_symlinks: bool,
|
||||
pub dry_run: bool,
|
||||
pub force: bool,
|
||||
pub version: Option<CompactString>,
|
||||
pub manifest_path: Option<PathBuf>,
|
||||
pub cli_overrides: PkgOverride,
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue