zshuper/modules/pacman.zsh
2018-02-03 02:29:33 +02:00

25 lines
554 B
Bash

#
# Wrap pacman so you don't need to put sudo before
# Optionally uses yaourt or pacaur
# Wrapper can be disabled using NO_PACMAN_WRAP=1 pacman -Syu
#
function pacman {
if [ ! -z "${NO_PACMAN_WRAP}" ]; then
sudo /usr/bin/pacman "$@"
return $?
fi
local ypath="$(command -v yaourt)"
local ppath="$(command -v pacaur)"
if [ ! -z "${ypath}" ]; then
"${ypath}" "$@"
elif [ ! -z "${ppath}" ]; then
"${ppath}" "$@"
else
sudo /usr/bin/pacman "$@"
fi
return $?
}
autoload -Uz pacman