add bash completion
This commit is contained in:
parent
69bdb100c4
commit
a311ba455f
4 changed files with 69 additions and 7 deletions
33
tools/weboob_bash_completion
Normal file
33
tools/weboob_bash_completion
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# weboob completion
|
||||
# Copyright 2010 Christophe Benz <christophe.benz@gmail.com>
|
||||
|
||||
# This script can be distributed under the same license as the
|
||||
# pastescript or bash packages.
|
||||
|
||||
have weboobcfg &&
|
||||
_weboob()
|
||||
{
|
||||
local cur videoob_options commands
|
||||
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
commands="$(${COMP_WORDS[0]} --commands)"
|
||||
options="$(${COMP_WORDS[0]} --options)"
|
||||
|
||||
case ${COMP_WORDS[1]} in
|
||||
*)
|
||||
COMPREPLY=( $( compgen -W "$commands $options" | grep "^$cur" ) )
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
|
||||
}
|
||||
[ "$have" ] || return
|
||||
weboob_applications=$(weboobcfg applications)
|
||||
for application in $weboob_applications
|
||||
do
|
||||
complete -F _weboob $application
|
||||
done
|
||||
|
||||
# vim: filetype=sh expandtab softtabstop=4 shiftwidth=4
|
||||
Loading…
Add table
Add a link
Reference in a new issue