mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-16 08:50:02 +00:00
Merge pull request #264 from NobodyXu/fix-repeated-crates-on-batch-installation
Fix repeated crates on batch installation: Dedup them and only keep the last one
This commit is contained in:
commit
f7625fcefc
5 changed files with 95 additions and 17 deletions
src
|
@ -32,6 +32,9 @@ struct Options {
|
|||
///
|
||||
/// When multiple names are provided, the --version option and any override options are
|
||||
/// unavailable due to ambiguity.
|
||||
///
|
||||
/// If duplicate names are provided, the last one (and their version requirement)
|
||||
/// is kept.
|
||||
#[clap(help_heading = "Package selection", value_name = "crate[@version]")]
|
||||
crate_names: Vec<CrateName>,
|
||||
|
||||
|
@ -242,11 +245,14 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
|||
""
|
||||
};
|
||||
|
||||
if option != "" {
|
||||
if !option.is_empty() {
|
||||
return Err(BinstallError::OverrideOptionUsedWithMultiInstall { option }.into());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicate crate_name, keep the last one
|
||||
let crate_names = CrateName::dedup(crate_names);
|
||||
|
||||
let cli_overrides = PkgOverride {
|
||||
pkg_url: opts.pkg_url.take(),
|
||||
pkg_fmt: opts.pkg_fmt.take(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue