From 516de7e0b883f733b0a95c1533d90746aa7b2fd9 Mon Sep 17 00:00:00 2001 From: pml68 Date: Fri, 8 Aug 2025 23:54:59 +0200 Subject: feat: do a diff check after changes / open PKGBUILD in editor for new pkg --- aur | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/aur b/aur index ac9da94..570784f 100755 --- a/aur +++ b/aur @@ -18,10 +18,14 @@ _help() { _update() { for dir in ~/.aur/*; do - [[ -e "$dir" ]] || break + cd "$dir" || continue - if [[ $(cd "$dir" && git pull) != "Already up to date." ]] || [[ $1 == "-f" ]] || [[ "$dir" == *-git && $1 == "-g" ]]; then - (cd "$dir" && makepkg -si ; _clean) + if [[ $(git pull) != "Already up to date." ]] || [[ $1 == "-f" ]] || [[ "$dir" == *-git && $1 == "-g" ]]; then + git diff "@{1}.." + read -p "Proceed with installation? [Y/n] " proceed + if [[ -z "$proceed" ]] || [[ "$proceed" == "Y" ]] || [[ "$proceed" == "y" ]]; then + makepkg -si ; _clean + fi fi done } @@ -34,9 +38,24 @@ _clean() { _update_or_install() { for package in "$@"; do if cd ~/.aur/"$package"; then - (git pull && makepkg -si ; _clean) + local proceed="" + + if [[ $(git pull) != "Already up to date." ]]; then + git diff "@{1}.." + read -p "Proceed with installation? [Y/n] " proceed + fi + + if [[ -z "$proceed" ]] || [[ "$proceed" == "Y" ]] || [[ "$proceed" == "y" ]]; then + makepkg -si ; _clean + fi else - (git clone "https://aur.archlinux.org/$package" ~/.aur/"$package" && cd ~/.aur/"$package" && makepkg -si ; _clean) + git clone "https://aur.archlinux.org/$package" ~/.aur/"$package" + cd ~/.aur/"$package" || continue + ${EDITOR:-nvim} PKGBUILD + read -p "Proceed with installation? [Y/n] " proceed + if [[ -z "$proceed" ]] || [[ "$proceed" == "Y" ]] || [[ "$proceed" == "y" ]]; then + makepkg -si ; _clean + fi fi done } -- cgit v1.2.3