From bf9813b7a49aa57973e6929beecf7bc4cc65fe5c Mon Sep 17 00:00:00 2001 From: JMARyA Date: Fri, 17 Jan 2025 22:48:19 +0100 Subject: [PATCH] add display for man entries + config files --- src/pkg/package.rs | 18 ++++++++++++++++++ src/routes/ui.rs | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/pkg/package.rs b/src/pkg/package.rs index d275835..d61a4a6 100644 --- a/src/pkg/package.rs +++ b/src/pkg/package.rs @@ -192,6 +192,24 @@ impl Package { Some(base) } + pub fn man_entries(&self) -> Vec { + 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 { + let files = self.file_list(); + files.into_iter().filter(|x| x.starts_with("etc")).collect() + } + pub fn systemd_units(&self) -> Vec { // TODO : Extract unit infos list_tar_file(&self.base_path().join(self.file_name())) diff --git a/src/routes/ui.rs b/src/routes/ui.rs index 6659fab..5a71a8e 100644 --- a/src/routes/ui.rs +++ b/src/routes/ui.rs @@ -36,6 +36,8 @@ pub async fn pkg_ui( let systemd_units = pkg.systemd_units(); let pacman_hooks = pkg.pacman_hooks(); let binaries = pkg.binaries(); + let man_entries = pkg.man_entries(); + let etc_entries = pkg.etc_entries(); let mut pkginfo = pkg.pkginfo(); let content = Div().vanish() @@ -217,6 +219,24 @@ pub async fn pkg_ui( ) ) ) + .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( InfoCard( Div().vanish().push(