summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-03-07 23:22:49 -0500
committerAllan McRae <allan@archlinux.org>2019-03-25 11:15:26 +1000
commitd37e6d40a19dadf41a223dcb1fde36c6fa622958 (patch)
tree77ae471befe051cc91a4de8ae432be4df37d1bc3
parent7a598d0845fda08e195e1a709297c761b68d79f4 (diff)
downloadpacman-d37e6d40a19dadf41a223dcb1fde36c6fa622958.tar.xz
bash-completion: support file redirection completions
The current completions don't properly handle redirection operators, and attempt to complete command completions rather than completing filenames to redirect to. bash-completion provides both _get_comp_words_by_ref and a higher-level wrapper _init_completion, but the latter provides handling of redirection operators, so switch to using that. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/completion/bash_completion.in18
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/completion/bash_completion.in b/scripts/completion/bash_completion.in
index c3249cd0..a1ab9fec 100644
--- a/scripts/completion/bash_completion.in
+++ b/scripts/completion/bash_completion.in
@@ -41,9 +41,9 @@ _pacman_keyids() {
}
_pacman_key() {
- local o cur opts prev wantfiles
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local o opts wantfiles
+ local cur prev words cword
+ _init_completion || return
opts=('add config delete edit-key export finger gpgdir
help import import-trustdb init keyserver list-keys list-sigs
lsign-key nocolor populate recv-keys refresh-keys updatedb
@@ -72,9 +72,9 @@ _pacman_key() {
_makepkg() {
compopt +o default
- local cur opts prev
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local opts
+ local cur prev words cword
+ _init_completion || return
if [[ $prev = @(-p|--config) ]]; then
compopt -o default
elif [[ ! $prev =~ ^-(-(config|help|key|version)$|\w*[Vh]) ]]; then
@@ -105,9 +105,9 @@ _pacman_repo_list() {
_pacman() {
compopt -o default
- local common core cur database files prev query remove sync upgrade o
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
+ local common core database files query remove sync upgrade o
+ local cur prev words cword
+ _init_completion || return
database=('asdeps asexplicit')
files=('list machinereadable owns search refresh regex' 'l o s x y')
query=('changelog check deps explicit file foreign groups info list native owns