diff options
author | Andres P <aepd87@gmail.com> | 2010-06-21 22:00:44 -0430 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2010-06-23 13:32:21 +1000 |
commit | 6f4f9c1b66ed859b3679d70e15c003ab4907b823 (patch) | |
tree | 883df5af577c55aea58ec2ccddda467db16fbaa6 /contrib/bash_completion | |
parent | 07a9effdd06345d09f09cdc92e23c937d8fa94b5 (diff) | |
download | pacman-6f4f9c1b66ed859b3679d70e15c003ab4907b823.tar.xz |
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>
Diffstat (limited to 'contrib/bash_completion')
-rw-r--r-- | contrib/bash_completion | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/bash_completion b/contrib/bash_completion index 2713ba4d..1ec2cd53 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -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 |