Skip to content

Commit

Permalink
fix(package): sort package selection order
Browse files Browse the repository at this point in the history
  • Loading branch information
QaidVoid committed Nov 16, 2024
1 parent d6c2b57 commit 7b6c490
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/registry/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ impl PackageStorage {

pub fn resolve_package(&self, package_name: &str, yes: bool) -> Result<ResolvedPackage> {
let pkg_query = parse_package_query(package_name);
let packages = self
let mut packages = self
.get_packages(&pkg_query)
.ok_or_else(|| anyhow::anyhow!("Package {} not found", package_name))?;

packages.sort_by(|a, b| {
a.package.family.cmp(&b.package.family)
});

let package = if yes || packages.len() == 1 {
&packages[0]
} else {
Expand Down

0 comments on commit 7b6c490

Please sign in to comment.