summaryrefslogtreecommitdiff
path: root/contrib/bash_completion.in
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bash_completion.in')
-rw-r--r--contrib/bash_completion.in31
1 files changed, 13 insertions, 18 deletions
diff --git a/contrib/bash_completion.in b/contrib/bash_completion.in
index 8983c92b..95a27702 100644
--- a/contrib/bash_completion.in
+++ b/contrib/bash_completion.in
@@ -31,12 +31,14 @@ _pacman_key() {
local cur opts prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
- if [[ $cur = -* &&
+ opts=('add delete export finger help list-keys recv-keys updatedb verify
+ version config edit-key gpgdir import import-trustdb init keyserver
+ list-sigs lsign-key populate refresh-keys'
+ 'a d e f h l r u v V')
+ if [[ $prev = 'pacman-key' ]]; then
+ _arch_ptr2comp opts
+ elif [[ $cur = -* &&
$prev != -@(a|-add|c|-config|g|-gpgdir|h|-help|import?(-trustdb)) ]]; then
- opts=('add delete export finger help list-keys recv-keys updatedb verify version
- config edit-key gpgdir import import-trustdb init keyserver list-sigs
- lsign-key populate refresh-keys'
- 'a d e f h l r u v V')
_arch_ptr2comp opts
fi
true
@@ -76,8 +78,8 @@ _pacman() {
remove=('cascade dbonly nodeps nosave print recursive unneeded' 'c n p s u')
sync=('asdeps asexplicit clean dbonly downloadonly force groups ignore ignoregroup
info list needed nodeps print refresh recursive search sysupgrade'
- 'c f g i l p s u w y')
- upgrade=('asdeps asexplicit force needed nodeps print recursive' 'f p')
+ 'c g i l p s u w y')
+ upgrade=('asdeps asexplicit force needed nodeps print recursive' 'p')
common=('arch cachedir config dbpath debug help logfile noconfirm
noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
core=('database help query remove sync upgrade version' 'D Q R S U V h')
@@ -111,18 +113,11 @@ _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
+_pacman_file() {
+ compopt -o filenames; _filedir 'pkg.tar*'
+}
+complete -F _pacman -o default pacman
complete -F _makepkg -o default makepkg
complete -F _pacman_key -o default pacman-key