Fix bash completion

* Add files to the possibilities (needed at least for pastoob).
  For now show them only if nothing else  matches.
* Remove useless "$have" test that failed every time
* Forget fake "hash" after running
* Simpler code overall
This commit is contained in:
Laurent Bachelier 2013-06-26 23:21:17 +02:00
commit 799e051285

View file

@ -22,26 +22,20 @@
# This script can be distributed under the same license as the
# weboob or bash packages.
hash weboob-config 2>/dev/null &&
_weboob()
{
local cur words
local cur args
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
words="$(${COMP_WORDS[0]} --shell-completion)"
case ${COMP_WORDS[1]} in
*)
COMPREPLY=( $( compgen -W "$words" | grep "^$cur" ) )
;;
esac
return 0
args="$(${COMP_WORDS[0]} --shell-completion)"
COMPREPLY=( $(compgen -o default -W "${args}" -- "$cur" ) )
}
[ "$have" ] || return
hash weboob-config 2>/dev/null &&
weboob_applications=$(weboob-config applications)
hash -d weboob-config
for application in $weboob_applications
do
complete -F _weboob $application