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>
This commit is contained in:
parent
7a598d0845
commit
d37e6d40a1
1 changed files with 9 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue