add display for man entries + config files

This commit is contained in:
JMARyA 2025-01-17 22:48:19 +01:00
parent 6c1ca1e8c0
commit bf9813b7a4
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 38 additions and 0 deletions

View file

@ -192,6 +192,24 @@ impl Package {
Some(base) Some(base)
} }
pub fn man_entries(&self) -> Vec<String> {
let files = self.file_list();
files
.into_iter()
.filter(|x| x.starts_with("usr/share/man"))
.map(|x| {
x.trim_start_matches("usr/share/man/")
.trim_end_matches(".gz")
.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()
}
pub fn systemd_units(&self) -> Vec<String> { pub fn systemd_units(&self) -> Vec<String> {
// TODO : Extract unit infos // TODO : Extract unit infos
list_tar_file(&self.base_path().join(self.file_name())) list_tar_file(&self.base_path().join(self.file_name()))

View file

@ -36,6 +36,8 @@ pub async fn pkg_ui(
let systemd_units = pkg.systemd_units(); let systemd_units = pkg.systemd_units();
let pacman_hooks = pkg.pacman_hooks(); let pacman_hooks = pkg.pacman_hooks();
let binaries = pkg.binaries(); let binaries = pkg.binaries();
let man_entries = pkg.man_entries();
let etc_entries = pkg.etc_entries();
let mut pkginfo = pkg.pkginfo(); let mut pkginfo = pkg.pkginfo();
let content = Div().vanish() let content = Div().vanish()
@ -216,6 +218,24 @@ pub async fn pkg_ui(
ListElements(&binaries) ListElements(&binaries)
) )
) )
)
.push_if(!man_entries.is_empty(),
|| InfoCard(
Div().vanish()
.push(CardTitle("Man Entries"))
.push(
ListElements(&man_entries)
)
)
)
.push_if(!etc_entries.is_empty(),
|| InfoCard(
Div().vanish()
.push(CardTitle("Config Files"))
.push(
ListElements(&etc_entries)
)
)
) )
.push( .push(
InfoCard( InfoCard(