2011-11-01 22:14:45 +02:00
|
|
|
# wtf completion -*- shell-script -*-
|
2009-10-19 23:18:57 +03:00
|
|
|
# Raphael Droz, 25/09/2009
|
|
|
|
|
|
|
|
_wtf()
|
|
|
|
{
|
2011-04-21 11:04:51 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-10-19 23:18:57 +03:00
|
|
|
|
2011-11-09 23:28:11 +02:00
|
|
|
[[ $prev == -f ]] && _filedir && return 0
|
|
|
|
[[ $cur == -* ]] && COMPREPLY=( -f ) && return 0
|
2009-10-19 23:18:57 +03:00
|
|
|
|
2011-04-21 11:04:51 +03:00
|
|
|
local db
|
|
|
|
|
|
|
|
set -- "${words[@]}"
|
2011-11-09 23:28:11 +02:00
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
if [[ $1 == -f ]]; then
|
2009-10-21 20:27:58 +03:00
|
|
|
shift ; db=$1 ; break
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
2011-11-09 23:28:11 +02:00
|
|
|
[[ -z $db ]] && db=${ACRONYMDB:-/usr/share/misc/acronyms*}
|
2009-10-21 20:27:58 +03:00
|
|
|
|
2011-04-21 12:20:59 +03:00
|
|
|
COMPREPLY=( $( compgen -W "$( cut -f 1 -s $db ) -f" -- "${cur^^}" ) )
|
2009-10-19 23:18:57 +03:00
|
|
|
} &&
|
2010-11-01 19:26:53 +02:00
|
|
|
complete -F _wtf wtf
|
2009-10-19 23:18:57 +03:00
|
|
|
|
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|