1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-03 17:50:11 +02: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() { __fdroid_cwd() {
if [[ "${PWD##*/}" == metadata ]]; then if [[ "${PWD##*/}" == metadata ]]; then
subdir= subdir=.
else else
[ -d metadata ] && subdir="metadata/" || return 1 [ -d metadata ] && subdir=metadata || return 1
fi fi
} }
@ -40,8 +40,9 @@ __fdroid_init() {
} }
__package() { __package() {
files=( ${subdir}*.txt ) [ -n "$subdir" ] || __fdroid_cwd
files=( ${files[@]#${subdir}} ) files=( ${subdir}/*.txt )
files=( ${files[@]#${subdir}/} )
files=${files[@]%.txt} files=${files[@]%.txt}
COMPREPLY=( $( compgen -W "$files" -- $cur ) ) COMPREPLY=( $( compgen -W "$files" -- $cur ) )
} }
@ -59,6 +60,7 @@ __vercode() {
done done
$p_found || return 0 $p_found || return 0
} }
[ -n "$subdir" ] || __fdroid_cwd
COMPREPLY=( $( compgen -W "$( while read line; do COMPREPLY=( $( compgen -W "$( while read line; do
if [[ "$line" == "Build Version:"* ]] if [[ "$line" == "Build Version:"* ]]
@ -70,7 +72,7 @@ __vercode() {
line="${line#*,}" line="${line#*,}"
printf "${line%%,*} " printf "${line%%,*} "
fi fi
done < "${subdir}${p}.txt" )" -- $cur ) ) done < "${subdir}/${p}.txt" )" -- $cur ) )
} }
__complete_options() { __complete_options() {