1
0
Fork 0
mirror of synced 2024-06-01 23:01:11 -04:00
zimfw/modules/pacman/init.zsh

40 lines
1.1 KiB
Bash
Raw Normal View History

2015-12-15 00:12:17 -05:00
#
# Pacman aliases and functions
#
# ensure pacman is available
2015-12-19 09:48:29 -05:00
if (( ! ${+commands[pacman]} )); then
2015-12-15 00:12:17 -05:00
return 1
fi
# find if there is a pacman wrapper available (and not set in .zimrc)
if [[ ${zpacman_frontend} == 'auto' ]]; then
# no frontend set in config; test for common frontends.
2015-12-19 09:48:29 -05:00
if (( ${+commands[powerpill]} )); then
2015-12-15 00:12:17 -05:00
zpacman_frontend='powerpill'
2015-12-19 09:48:29 -05:00
elif (( ${+commands[pacmatic]} )); then
2015-12-15 00:12:17 -05:00
zpacman_frontend='pacmatic'
else
zpacman_frontend='pacman'
fi
2015-12-19 09:48:29 -05:00
elif (( ! ${+zpacman_frontend} )); then
2015-12-15 23:09:36 -05:00
zpacman_frontend='pacman'
2015-12-19 09:48:29 -05:00
elif (( ! ${+commands[${zpacman_frontend}]} )); then
2015-12-15 00:12:17 -05:00
print "pacman frontend \"${zpacman_frontend}\" is invalid or not installed. Reverting to \"pacman\"." >&2
print "you can fix this error by editing the 'zpacman_frontend' variable in your .zimrc" >&2
zpacman_frontend='pacman'
fi
# source helper functions/aliases
for helper ( ${zpacman_helper[@]} ); do
if [[ -s ${0:h}/helper_${helper}.zsh ]]; then
source ${0:h}/helper_${helper}.zsh
else
print "no such helper script \"helper_${helper}.zsh\"" >&2
fi
done
# source pacman aliases
source ${0:h}/alias.zsh