mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-23 02:56:37 +00:00
fix: Skip binaries user didn't requst (#2199)
* fix: Skip binaries user didn't requst Users may request only a subset of binaries via the --bin flag. In that case, do not fail if binaries other than the ones requested are missing from the downloaded archive. * fix resolve.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * fix resolve.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * fix resolve.rs --------- Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
aa459296fa
commit
4628235403
4 changed files with 56 additions and 1 deletions
|
@ -193,6 +193,7 @@ async fn resolve_inner(
|
|||
&package_info,
|
||||
&opts.install_path,
|
||||
opts.no_symlinks,
|
||||
&opts.bins,
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
@ -289,6 +290,7 @@ async fn download_extract_and_verify(
|
|||
package_info: &PackageInfo,
|
||||
install_path: &Path,
|
||||
no_symlinks: bool,
|
||||
bins: &Option<Vec<CompactString>>,
|
||||
) -> Result<Vec<bins::BinFile>, BinstallError> {
|
||||
// Download and extract it.
|
||||
// If that fails, then ignore this fetcher.
|
||||
|
@ -316,6 +318,14 @@ async fn download_extract_and_verify(
|
|||
.iter()
|
||||
.zip(bin_files)
|
||||
.filter_map(|(bin, bin_file)| {
|
||||
// skip binaries that were not requested by user
|
||||
if bins
|
||||
.as_ref()
|
||||
.is_some_and(|bins| !bins.iter().any(|b| b == bin.name))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
match bin_file.check_source_exists(&mut |p| extracted_files.has_file(p)) {
|
||||
Ok(()) => Some(Ok(bin_file)),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue