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:
parent
dfa28b8420
commit
799e051285
1 changed files with 6 additions and 12 deletions
|
|
@ -22,26 +22,20 @@
|
||||||
# This script can be distributed under the same license as the
|
# This script can be distributed under the same license as the
|
||||||
# weboob or bash packages.
|
# weboob or bash packages.
|
||||||
|
|
||||||
hash weboob-config 2>/dev/null &&
|
|
||||||
_weboob()
|
_weboob()
|
||||||
{
|
{
|
||||||
local cur words
|
local cur args
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
words="$(${COMP_WORDS[0]} --shell-completion)"
|
args="$(${COMP_WORDS[0]} --shell-completion)"
|
||||||
|
|
||||||
case ${COMP_WORDS[1]} in
|
|
||||||
*)
|
|
||||||
COMPREPLY=( $( compgen -W "$words" | grep "^$cur" ) )
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
COMPREPLY=( $(compgen -o default -W "${args}" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
[ "$have" ] || return
|
|
||||||
|
hash weboob-config 2>/dev/null &&
|
||||||
weboob_applications=$(weboob-config applications)
|
weboob_applications=$(weboob-config applications)
|
||||||
|
hash -d weboob-config
|
||||||
for application in $weboob_applications
|
for application in $weboob_applications
|
||||||
do
|
do
|
||||||
complete -F _weboob $application
|
complete -F _weboob $application
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue