1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 07:48:50 -05:00

bash_completion: fix bash 3.2 incompatibility

To avoid errors with bash 3.2, compopt will be skipped if it's not a
shell builtin.

compopt is needed to not append slashes to package names that
coincide with directories in PWD.

This is currently not possible to fix in bash versions that do not support
compopt, so these users will have to bear that regression.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andres P 2010-06-21 22:00:44 -04:30 committed by Allan McRae
parent 07a9effdd0
commit 6f4f9c1b66

View File

@ -52,10 +52,6 @@ _pacman_pkg() {
)"
}
_pacman_file() {
compopt -o filenames; _filedir 'pkg.tar.*'
}
_pacman() {
local common core cur database prev query remove sync upgrade o
COMPREPLY=()
@ -102,7 +98,18 @@ _pacman() {
true
}
if [[ $(type -t compopt) = "builtin" ]]; then
_pacman_file() {
compopt -o filenames; _filedir 'pkg.tar.*'
}
complete -F _pacman -o default pacman
else
_pacman_file() {
_filedir 'pkg.tar.*'
}
complete -F _pacman -o filenames -o default pacman
fi
complete -F _makepkg -o default makepkg
complete -F _pacman -o default pacman
# ex:et ts=2 sw=2 ft=sh