zshuper/modules/pacman.zsh

25 lines
554 B
Bash
Raw Normal View History

2018-02-03 02:29:33 +02:00
#
2016-06-19 04:11:34 +03:00
# Wrap pacman so you don't need to put sudo before
2018-02-03 02:29:33 +02:00
# Optionally uses yaourt or pacaur
# Wrapper can be disabled using NO_PACMAN_WRAP=1 pacman -Syu
#
2016-06-19 04:11:34 +03:00
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
2018-02-03 02:29:33 +02:00
"${ypath}" "$@"
2016-06-19 04:11:34 +03:00
elif [ ! -z "${ppath}" ]; then
2018-02-03 02:29:33 +02:00
"${ppath}" "$@"
2016-06-19 04:11:34 +03:00
else
sudo /usr/bin/pacman "$@"
fi
return $?
}
2018-02-03 02:29:33 +02:00
autoload -Uz pacman