From d37e6d40a19dadf41a223dcb1fde36c6fa622958 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 7 Mar 2019 23:22:49 -0500 Subject: 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 Signed-off-by: Allan McRae --- scripts/completion/bash_completion.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'scripts/completion') 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 -- cgit v1.2.3-70-g09d2