commands/update: use flexver for version sorting
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I4e1cd3247e74247cbde65391510bd3586a6a6964
This commit is contained in:
parent
af3cdbf343
commit
2c4058b54a
1 changed files with 10 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ use crate::{
|
||||||
error::{MultiError, PakkerError},
|
error::{MultiError, PakkerError},
|
||||||
model::{Config, LockFile, UpdateStrategy},
|
model::{Config, LockFile, UpdateStrategy},
|
||||||
ui_utils::{prompt_select, prompt_typo_suggestion, prompt_yes_no},
|
ui_utils::{prompt_select, prompt_typo_suggestion, prompt_yes_no},
|
||||||
|
utils::FlexVer,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub async fn execute(
|
pub async fn execute(
|
||||||
|
|
@ -141,6 +142,15 @@ pub async fn execute(
|
||||||
&& !updated_project.files.is_empty()
|
&& !updated_project.files.is_empty()
|
||||||
&& let Some(old_file) = lockfile.projects[idx].files.first()
|
&& let Some(old_file) = lockfile.projects[idx].files.first()
|
||||||
{
|
{
|
||||||
|
// Sort files by FlexVer if that strategy is set
|
||||||
|
if old_project.update_strategy == UpdateStrategy::FlexVer {
|
||||||
|
updated_project.files.sort_by(|a, b| {
|
||||||
|
// Use FlexVer for comparison - b.cmp(a) gives descending order
|
||||||
|
// (newest first)
|
||||||
|
FlexVer(&b.file_name).cmp(&FlexVer(&a.file_name))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Clone data needed for comparisons to avoid borrow issues
|
// Clone data needed for comparisons to avoid borrow issues
|
||||||
let new_file_id = updated_project.files.first().unwrap().id.clone();
|
let new_file_id = updated_project.files.first().unwrap().id.clone();
|
||||||
let new_file_name =
|
let new_file_name =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue