mirror of
https://github.com/edera-dev/sprout.git
synced 2026-02-05 05:30:16 +00:00
feat(boot): introduce sort keys, which are sorted in reverse order, to make boot order more configurable (#55)
This commit is contained in:
@@ -7,6 +7,7 @@ use crate::context::{RootContext, SproutContext};
|
||||
use crate::entries::BootableEntry;
|
||||
use crate::options::SproutOptions;
|
||||
use crate::phases::phase;
|
||||
use crate::utils::vercmp::compare_versions;
|
||||
use alloc::collections::BTreeMap;
|
||||
use alloc::format;
|
||||
use alloc::string::ToString;
|
||||
@@ -257,6 +258,10 @@ fn run() -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the entries by their sort key, finalizing the order to show entries. This happens
|
||||
// in reverse order so that entries that would come last show up first in the menu.
|
||||
entries.sort_by(|a, b| compare_versions(a.sort_key(), b.sort_key()).reverse());
|
||||
|
||||
// Tell the bootloader interface what entries are available.
|
||||
BootloaderInterface::set_entries(entries.iter().map(|entry| entry.name()))
|
||||
.context("unable to set entries in bootloader interface")?;
|
||||
|
||||
Reference in New Issue
Block a user