add more package info
This commit is contained in:
parent
bf9813b7a4
commit
8b7e357c0e
2 changed files with 115 additions and 10 deletions
|
@ -205,6 +205,64 @@ impl Package {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn kernel_modules(&self) -> Vec<String> {
|
||||
let files = self.file_list();
|
||||
files
|
||||
.into_iter()
|
||||
.filter(|x| x.starts_with("usr/lib/modules"))
|
||||
.map(|x| {
|
||||
x.trim_start_matches("usr/lib/modules/")
|
||||
.trim_end_matches(".zst")
|
||||
.to_string()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn firmware(&self) -> Vec<String> {
|
||||
let files = self.file_list();
|
||||
files
|
||||
.into_iter()
|
||||
.filter(|x| x.starts_with("usr/lib/firmware"))
|
||||
.map(|x| {
|
||||
x.trim_start_matches("usr/lib/firmware/")
|
||||
.trim_end_matches(".zst")
|
||||
.to_string()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn keyrings(&self) -> Vec<String> {
|
||||
let files = self.file_list();
|
||||
files
|
||||
.into_iter()
|
||||
.filter(|x| x.starts_with("usr/share/pacman/keyrings"))
|
||||
.map(|x| {
|
||||
x.trim_start_matches("usr/share/pacman/keyrings/")
|
||||
.to_string()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn shared_objects(&self) -> Vec<String> {
|
||||
list_tar_file(&self.base_path().join(self.file_name()))
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.filter(|x| {
|
||||
let file_name = x.split("/").last().unwrap();
|
||||
file_name.contains(".so.") || file_name.ends_with(".so")
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn icons(&self) -> Vec<String> {
|
||||
let files = self.file_list();
|
||||
files
|
||||
.into_iter()
|
||||
.filter(|x| x.starts_with("usr/share/icons"))
|
||||
.map(|x| x.trim_start_matches("usr/share/icons/").to_string())
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn etc_entries(&self) -> Vec<String> {
|
||||
let files = self.file_list();
|
||||
files.into_iter().filter(|x| x.starts_with("etc")).collect()
|
||||
|
@ -217,7 +275,7 @@ impl Package {
|
|||
.into_iter()
|
||||
.filter(|x| {
|
||||
let ext = x.split(".").last().unwrap();
|
||||
ext == "service" || ext == "timer" || ext == "mount"
|
||||
ext == "service" || ext == "timer" || ext == "mount" || ext == "socket"
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
|
|
@ -38,6 +38,11 @@ pub async fn pkg_ui(
|
|||
let binaries = pkg.binaries();
|
||||
let man_entries = pkg.man_entries();
|
||||
let etc_entries = pkg.etc_entries();
|
||||
let kernel_modules = pkg.kernel_modules();
|
||||
let firmware = pkg.firmware();
|
||||
let keyrings = pkg.keyrings();
|
||||
let shared_objects = pkg.shared_objects();
|
||||
let icons = pkg.icons();
|
||||
let mut pkginfo = pkg.pkginfo();
|
||||
|
||||
let content = Div().vanish()
|
||||
|
@ -218,7 +223,47 @@ pub async fn pkg_ui(
|
|||
ListElements(&binaries)
|
||||
)
|
||||
)
|
||||
) .push_if(!kernel_modules.is_empty(),
|
||||
|| InfoCard(
|
||||
Div().vanish()
|
||||
.push(CardTitle("Kernel Modules"))
|
||||
.push(
|
||||
ListElements(&kernel_modules)
|
||||
)
|
||||
)
|
||||
).push_if(!shared_objects.is_empty(),
|
||||
|| InfoCard(
|
||||
Div().vanish()
|
||||
.push(CardTitle("Shared Objects (Libraries)"))
|
||||
.push(
|
||||
ListElements(&shared_objects)
|
||||
)
|
||||
)
|
||||
).push_if(!firmware.is_empty(),
|
||||
|| InfoCard(
|
||||
Div().vanish()
|
||||
.push(CardTitle("Firmware"))
|
||||
.push(
|
||||
ListElements(&firmware)
|
||||
)
|
||||
)
|
||||
).push_if(!keyrings.is_empty(),
|
||||
|| InfoCard(
|
||||
Div().vanish()
|
||||
.push(CardTitle("Pacman Keyrings"))
|
||||
.push(
|
||||
ListElements(&keyrings)
|
||||
)
|
||||
)
|
||||
).push_if(!icons.is_empty(),
|
||||
|| InfoCard(
|
||||
Div().vanish()
|
||||
.push(CardTitle("Icons"))
|
||||
.push(
|
||||
ListElements(&icons)
|
||||
)
|
||||
)
|
||||
)
|
||||
.push_if(!man_entries.is_empty(),
|
||||
|| InfoCard(
|
||||
Div().vanish()
|
||||
|
@ -316,14 +361,11 @@ pub async fn repo_ui(
|
|||
.push_if(config.is_mirrored_repo(&repo.name), || {
|
||||
Background(
|
||||
Blue::_500,
|
||||
Rounded(
|
||||
Margin(
|
||||
Padding(Text("Mirrored").sm().medium().white())
|
||||
.x(ScreenValue::_3)
|
||||
.y(ScreenValue::_1),
|
||||
)
|
||||
.left(ScreenValue::_4),
|
||||
)
|
||||
Rounded(Margin(
|
||||
Padding(Text("Mirrored").sm().medium().white())
|
||||
.x(ScreenValue::_3)
|
||||
.y(ScreenValue::_1),
|
||||
))
|
||||
.size(Size::Full),
|
||||
)
|
||||
})
|
||||
|
@ -345,10 +387,15 @@ pub async fn repo_ui(
|
|||
.group()
|
||||
.gap(ScreenValue::_2),
|
||||
)
|
||||
.left(ScreenValue::_4)
|
||||
.top(ScreenValue::_2)),
|
||||
)
|
||||
.push(
|
||||
Text(&format!("{} packages", packages.len()))
|
||||
.sm()
|
||||
.color(&Gray::_100),
|
||||
),
|
||||
)
|
||||
.gap(ScreenValue::_3)
|
||||
.wrap(Wrap::Wrap)
|
||||
.full_center()
|
||||
.group(),
|
||||
|
|
Loading…
Add table
Reference in a new issue