Improve safety and CLI fidelity for everyday use
Drop default --noconfirm (opt-in via --noconfirm), fix --noremovemake, forward pacman argv intact for -R/-D/-F/-T/-U, deepen PKGBUILD review, show an install plan before building, and add shellcheck CI plus unit tests. Co-authored-by: Frank Vitrano <WHC2006@users.noreply.github.com>
This commit is contained in:
co-authored by
Frank Vitrano
parent
d0f2cfe335
commit
bba71040d6
@@ -34,6 +34,28 @@ warn() { printf '%s==>%s WARNING: %s\n' "${C_BOLD}${C_YELLOW}" "${C_RESET}" "$*"
|
||||
error() { printf '%s==>%s ERROR: %s\n' "${C_BOLD}${C_RED}" "${C_RESET}" "$*" >&2; }
|
||||
die() { error "$*"; exit 1; }
|
||||
|
||||
# Append --noconfirm when requested (default: ask, like pacman/paru).
|
||||
pac_noconfirm_args() {
|
||||
if [[ ${MIAUR_NOCONFIRM:-0} -eq 1 ]]; then
|
||||
printf '%s\n' --noconfirm
|
||||
fi
|
||||
}
|
||||
|
||||
# Prompt Y/n; returns 0 to continue. Skipped when --noconfirm.
|
||||
confirm_ask() {
|
||||
local prompt=${1:-Continue?}
|
||||
if [[ ${MIAUR_NOCONFIRM:-0} -eq 1 ]]; then
|
||||
return 0
|
||||
fi
|
||||
printf '%s::%s %s [Y/n] ' "${C_BOLD}${C_BLUE}" "${C_RESET}" "$prompt" >&2
|
||||
local ans=
|
||||
read -r ans || return 1
|
||||
case "${ans:-y}" in
|
||||
y | Y | yes | YES | '') return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
need_cmd() {
|
||||
local c
|
||||
for c in "$@"; do
|
||||
|
||||
Reference in New Issue
Block a user