wtf: Don't offer -f if it was already specified.
Submitted-by: Raphaël Droz (modified) http://lists.alioth.debian.org/pipermail/bash-completion-devel/2013-November/004991.html
This commit is contained in:
parent
f5df66f476
commit
e694978346
@ -3,11 +3,15 @@
|
||||
|
||||
_wtf()
|
||||
{
|
||||
local cur prev words cword
|
||||
local cur prev words cword addf
|
||||
_init_completion || return
|
||||
|
||||
[[ $prev == -f ]] && _filedir && return 0
|
||||
[[ $cur == -* ]] && COMPREPLY=( -f ) && return 0
|
||||
[[ ${words[@]} == *\ -f* ]] && addf= || addf=-f
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=( $addf )
|
||||
return 0
|
||||
fi
|
||||
|
||||
local db
|
||||
|
||||
@ -20,7 +24,7 @@ _wtf()
|
||||
done
|
||||
[[ -z $db ]] && db=${ACRONYMDB:-/usr/share/misc/acronyms*}
|
||||
|
||||
COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db 2>/dev/null ) -f" \
|
||||
COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db 2>/dev/null ) $addf" \
|
||||
-- "${cur^^}" ) )
|
||||
} &&
|
||||
complete -F _wtf wtf
|
||||
|
Loading…
x
Reference in New Issue
Block a user