1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

Fix subdir tweaks in the bash completion

This commit is contained in:
Daniel Martí 2013-11-18 15:40:00 +01:00
parent f384b5f761
commit f4140a17c3

View File

@ -25,9 +25,9 @@
__fdroid_cwd() {
if [[ "${PWD##*/}" == metadata ]]; then
subdir=
subdir=.
else
[ -d metadata ] && subdir="metadata/" || return 1
[ -d metadata ] && subdir=metadata || return 1
fi
}
@ -40,8 +40,9 @@ __fdroid_init() {
}
__package() {
files=( ${subdir}*.txt )
files=( ${files[@]#${subdir}} )
[ -n "$subdir" ] || __fdroid_cwd
files=( ${subdir}/*.txt )
files=( ${files[@]#${subdir}/} )
files=${files[@]%.txt}
COMPREPLY=( $( compgen -W "$files" -- $cur ) )
}
@ -59,6 +60,7 @@ __vercode() {
done
$p_found || return 0
}
[ -n "$subdir" ] || __fdroid_cwd
COMPREPLY=( $( compgen -W "$( while read line; do
if [[ "$line" == "Build Version:"* ]]
@ -70,7 +72,7 @@ __vercode() {
line="${line#*,}"
printf "${line%%,*} "
fi
done < "${subdir}${p}.txt" )" -- $cur ) )
done < "${subdir}/${p}.txt" )" -- $cur ) )
}
__complete_options() {