pub mod browse;
pub mod pending;
pub mod selfcmd;
use crate::model::World;
pub fn load_world() -> World {
let mut world = match crate::backend::detect() {
Some(backend) => match backend.build_world() {
Ok(world) => world,
Err(e) => {
eprintln!(
"whypkg: failed to read package data ({}): {e}",
backend.name()
);
std::process::exit(1);
}
},
None => {
if crate::backend::flatpak::available() {
World::empty()
} else {
eprintln!(
"whypkg: no supported package manager found.\n\
supported: apt/dpkg, pacman, dnf (and flatpak, alongside any of them)."
);
std::process::exit(1);
}
}
};
if crate::backend::flatpak::available() {
crate::backend::flatpak::augment(&mut world);
}
world
}