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() {
|
_pacman_key() {
|
||||||
local o cur opts prev wantfiles
|
local o opts wantfiles
|
||||||
COMPREPLY=()
|
local cur prev words cword
|
||||||
_get_comp_words_by_ref cur prev
|
_init_completion || return
|
||||||
opts=('add config delete edit-key export finger gpgdir
|
opts=('add config delete edit-key export finger gpgdir
|
||||||
help import import-trustdb init keyserver list-keys list-sigs
|
help import import-trustdb init keyserver list-keys list-sigs
|
||||||
lsign-key nocolor populate recv-keys refresh-keys updatedb
|
lsign-key nocolor populate recv-keys refresh-keys updatedb
|
||||||
|
@ -72,9 +72,9 @@ _pacman_key() {
|
||||||
|
|
||||||
_makepkg() {
|
_makepkg() {
|
||||||
compopt +o default
|
compopt +o default
|
||||||
local cur opts prev
|
local opts
|
||||||
COMPREPLY=()
|
local cur prev words cword
|
||||||
_get_comp_words_by_ref cur prev
|
_init_completion || return
|
||||||
if [[ $prev = @(-p|--config) ]]; then
|
if [[ $prev = @(-p|--config) ]]; then
|
||||||
compopt -o default
|
compopt -o default
|
||||||
elif [[ ! $prev =~ ^-(-(config|help|key|version)$|\w*[Vh]) ]]; then
|
elif [[ ! $prev =~ ^-(-(config|help|key|version)$|\w*[Vh]) ]]; then
|
||||||
|
@ -105,9 +105,9 @@ _pacman_repo_list() {
|
||||||
|
|
||||||
_pacman() {
|
_pacman() {
|
||||||
compopt -o default
|
compopt -o default
|
||||||
local common core cur database files prev query remove sync upgrade o
|
local common core database files query remove sync upgrade o
|
||||||
COMPREPLY=()
|
local cur prev words cword
|
||||||
_get_comp_words_by_ref cur prev
|
_init_completion || return
|
||||||
database=('asdeps asexplicit')
|
database=('asdeps asexplicit')
|
||||||
files=('list machinereadable owns search refresh regex' 'l o s x y')
|
files=('list machinereadable owns search refresh regex' 'l o s x y')
|
||||||
query=('changelog check deps explicit file foreign groups info list native owns
|
query=('changelog check deps explicit file foreign groups info list native owns
|
||||||
|
|
Loading…
Add table
Reference in a new issue