[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 16c00d6d874f334106ee3b073d11ac6a14986b42

Ville Skyttä ville.skytta at iki.fi
Mon Oct 19 20:19:57 UTC 2009


The following commit has been merged in the master branch:
commit 16c00d6d874f334106ee3b073d11ac6a14986b42
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Mon Oct 19 23:18:57 2009 +0300

    Add wtf completion, based on work by Raphaël Droz.

diff --git a/CHANGES b/CHANGES
index 081d2ff..9f22f0f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,7 @@ bash-completion (1.x)
   * Apply pine completion to alpine too.
   * Remove many unnecessary short option completions where long ones exist.
   * Improve gkrellm completion.
+  * Add wtf completion, based on work by Raphaël Droz.
 
  -- David Paleino <d.paleino at gmail.com>  Sun, 11 Oct 2009 11:11:57 +0200
 
diff --git a/Makefile.am b/Makefile.am
index 9562402..2c717bd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,6 +136,7 @@ bashcomp_DATA = contrib/ant \
 		contrib/vpnc \
 		contrib/wireless-tools \
 		contrib/wodim \
+		contrib/wtf \
 		contrib/wvdial \
 		contrib/xhost \
 		contrib/xm \
diff --git a/contrib/wtf b/contrib/wtf
new file mode 100644
index 0000000..c1d19a6
--- /dev/null
+++ b/contrib/wtf
@@ -0,0 +1,26 @@
+# wtf completion
+# Raphael Droz, 25/09/2009
+
+have wtf &&
+_wtf()
+{
+    local cur prev db
+
+    COMPREPLY=()
+    cur=`_get_cword`
+    prev=${COMP_WORDS[COMP_CWORD-1]}
+
+    [ "$prev" = -f ] && _filedir && return 0
+
+    db=${ACRONYMDB:-/usr/share/misc/acronyms*}
+    COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db )" -- "${cur^^}" ) )
+} &&
+complete -F _wtf $filenames wtf
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh

-- 
bash-completion



More information about the Bash-completion-commits mailing list