completion: set up _fdroid_* funcs at load time

This fixes an issue where these functions would not be created until fdroid
was completed at least once.
This commit is contained in:
Daniel Martí 2015-09-02 21:23:08 -07:00
parent f23011f408
commit 9eef437bca

View file

@ -267,19 +267,22 @@ __complete_init() {
__complete_options
}
_fdroid() {
local cmd cmds
cmd=${COMP_WORDS[1]}
cmds=" build init install update publish checkupdates import \
readmeta rewritemeta lint scanner verify stats server signindex "
__cmds=" build init install update publish checkupdates import readmeta \
rewritemeta lint scanner verify stats server signindex "
for c in $cmds; do eval "_fdroid_${c} () {
for c in $__cmds; do
eval "_fdroid_${c} () {
local cur prev opts lopts
__fdroid_init ${c};
}"; done
__fdroid_init ${c}
}"
done
[[ $cmds == *\ $cmd\ * ]] && _fdroid_${cmd} || {
(($COMP_CWORD == 1)) && COMPREPLY=( $( compgen -W "${cmds}" -- $cmd ) )
_fdroid() {
local cmd
cmd=${COMP_WORDS[1]}
[[ $__cmds == *\ $cmd\ * ]] && _fdroid_${cmd} || {
(($COMP_CWORD == 1)) && COMPREPLY=( $( compgen -W "${__cmds}" -- $cmd ) )
}
}