[Bash-completion-commits] [bash-completion] 02/04: wtf: Don't offer -f if it was already specified.

Ville Skyttä scop-guest at moszumanska.debian.org
Tue Nov 26 17:52:49 UTC 2013


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit e694978346b017d92dfeb7968fc57d018c8721a4
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Nov 26 19:41:34 2013 +0200

    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
---
 completions/wtf | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/completions/wtf b/completions/wtf
index d85e981..651d687 100644
--- a/completions/wtf
+++ b/completions/wtf
@@ -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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list