From c8d972261b3d536298cc10e36b1ab5153f2adc57 Mon Sep 17 00:00:00 2001 From: pml68 Date: Thu, 21 Aug 2025 15:37:22 +0200 Subject: feat: `set -eu` --- aur | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aur b/aur index 570784f..af953c4 100755 --- a/aur +++ b/aur @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + _help() { echo "Usage: $(basename "$0") [OPTIONS]" echo "" @@ -13,14 +15,14 @@ _help() { echo " -h, --help Display this help text." echo " [nothing] Check all packages for updates." echo "" - exit "$1" + exit "${1-0}" } _update() { for dir in ~/.aur/*; do cd "$dir" || continue - if [[ $(git pull) != "Already up to date." ]] || [[ $1 == "-f" ]] || [[ "$dir" == *-git && $1 == "-g" ]]; then + 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 @@ -60,8 +62,8 @@ _update_or_install() { done } -if [[ -n $1 ]]; then - case $1 in +if [[ -n "${1-}" ]]; then + case "$1" in --list | -l) pacman -Qm ;; -- cgit v1.2.3