This commit is contained in:
parent
66ac061630
commit
6ee1500795
2 changed files with 38 additions and 6 deletions
|
@ -280,6 +280,23 @@ impl Package {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn readmes(&self) -> Vec<(String, String)> {
|
||||||
|
let pkg_file = self.base_path().join(self.file_name());
|
||||||
|
let files = self.file_list();
|
||||||
|
files
|
||||||
|
.into_iter()
|
||||||
|
.filter(|x| {
|
||||||
|
let file_name = x.split("/").last().unwrap();
|
||||||
|
let cleaned = file_name.trim_end_matches(".md").trim_end_matches(".txt");
|
||||||
|
cleaned == "README"
|
||||||
|
})
|
||||||
|
.map(|x| {
|
||||||
|
let content = read_file_tar(&pkg_file, &x).unwrap();
|
||||||
|
(x, content)
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn pacman_hooks(&self) -> Vec<(String, String)> {
|
pub fn pacman_hooks(&self) -> Vec<(String, String)> {
|
||||||
let pkg_file = self.base_path().join(self.file_name());
|
let pkg_file = self.base_path().join(self.file_name());
|
||||||
let files = self.file_list();
|
let files = self.file_list();
|
||||||
|
|
|
@ -43,6 +43,7 @@ pub async fn pkg_ui(
|
||||||
let keyrings = pkg.keyrings();
|
let keyrings = pkg.keyrings();
|
||||||
let shared_objects = pkg.shared_objects();
|
let shared_objects = pkg.shared_objects();
|
||||||
let icons = pkg.icons();
|
let icons = pkg.icons();
|
||||||
|
let readmes = pkg.readmes();
|
||||||
let mut pkginfo = pkg.pkginfo();
|
let mut pkginfo = pkg.pkginfo();
|
||||||
|
|
||||||
let content = Div().vanish()
|
let content = Div().vanish()
|
||||||
|
@ -203,17 +204,31 @@ pub async fn pkg_ui(
|
||||||
Padding(Rounded(Background(Gray::_700, Code(&hook.1).sm().color(&Gray::_100))).size(Size::Large)).all(ScreenValue::_4)
|
Padding(Rounded(Background(Gray::_700, Code(&hook.1).sm().color(&Gray::_100))).size(Size::Large)).all(ScreenValue::_4)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.push(
|
|
||||||
html! {
|
|
||||||
@for unit in &systemd_units {
|
|
||||||
li { (unit) }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
).y(ScreenValue::_1)
|
).y(ScreenValue::_1)
|
||||||
).list_style(ListStyle::Disc).color(&Gray::_300)
|
).list_style(ListStyle::Disc).color(&Gray::_300)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
.push_if(!readmes.is_empty(),
|
||||||
|
|| InfoCard(
|
||||||
|
Div().vanish().push(CardTitle("READMEs")).push(
|
||||||
|
Paragraph(
|
||||||
|
SpaceBetween(
|
||||||
|
Div().vanish()
|
||||||
|
.push_for_each(&readmes, |readme: &(String, String)| {
|
||||||
|
Div().vanish()
|
||||||
|
.push(
|
||||||
|
Text(&readme.0).xl().semibold().color(&Gray::_300)
|
||||||
|
)
|
||||||
|
.push(
|
||||||
|
Padding(Rounded(Background(Gray::_700, Code(&readme.1).sm().color(&Gray::_100))).size(Size::Large)).all(ScreenValue::_4)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
).y(ScreenValue::_1)
|
||||||
|
).list_style(ListStyle::Disc).color(&Gray::_300)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
.push_if(!binaries.is_empty(),
|
.push_if(!binaries.is_empty(),
|
||||||
|| InfoCard(
|
|| InfoCard(
|
||||||
Div().vanish()
|
Div().vanish()
|
||||||
|
|
Loading…
Add table
Reference in a new issue