2009-10-19 23:18:57 +03:00
|
|
|
# wtf completion
|
|
|
|
# Raphael Droz, 25/09/2009
|
|
|
|
|
2011-04-05 00:35:51 +03:00
|
|
|
have wtf || return
|
|
|
|
|
2009-10-19 23:18:57 +03:00
|
|
|
_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
|
|
|
|
|
|
|
[ "$prev" = -f ] && _filedir && return 0
|
2009-10-21 20:27:58 +03:00
|
|
|
[[ "$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[@]}"
|
2009-10-21 20:27:58 +03:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
if [ "$1" = -f ]; then
|
|
|
|
shift ; db=$1 ; break
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
[ -z $db ] && db=${ACRONYMDB:-/usr/share/misc/acronyms*}
|
|
|
|
|
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
|
|
|
|
|
|
|
# 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
|