From b0dec6d5cf869be2270e28a7d9f33587868e5bac Mon Sep 17 00:00:00 2001 From: jan Michal Date: Fri, 25 Feb 2022 19:33:17 +0000 Subject: [PATCH] fixed #21 --- src/operations/aur_install.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/operations/aur_install.rs b/src/operations/aur_install.rs index 13f0312..130f541 100644 --- a/src/operations/aur_install.rs +++ b/src/operations/aur_install.rs @@ -97,10 +97,13 @@ pub fn aur_install(a: Vec, options: Options) { if !noconfirm { let p1 = prompt( - format!("Would you like to review {}'s PKGBUILD?", pkg), + format!( + "Would you like to review {}'s PKGBUILD (and any .install files if present)?", + pkg + ), false, ); - let editor = env::var("PAGER").unwrap_or_else(|_| "less".parse().unwrap()); + let editor: &str = &env::var("PAGER").unwrap_or_else(|_| "less".parse().unwrap()); if p1 { Command::new(editor) @@ -109,6 +112,21 @@ pub fn aur_install(a: Vec, options: Options) { .unwrap() .wait() .unwrap(); + + let out = Command::new("bash") + .args(&["-c", &format!("ls {}/*.install &> /dev/null", pkg)]) + .status() + .unwrap(); + + if out.code() == Some(0) { + Command::new("bash") + .args(&["-c", &format!("{} {}/*.install", editor, pkg)]) + .spawn() + .unwrap() + .wait() + .unwrap(); + } + let p2 = prompt(format!("Would you still like to install {}?", pkg), true); if !p2 { fs::remove_dir_all(format!("{}/{}", cachedir, pkg)).unwrap();