mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 15:02:51 +03:00
fix version codes in bash completion for fdroid build
I'm not sure the old code ever worked, but this works now, and supports .yml. closes #719
This commit is contained in:
parent
95c3ab2454
commit
cc5aed3c1f
1 changed files with 14 additions and 15 deletions
|
@ -60,20 +60,14 @@ __apk_vercode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__vercode() {
|
__vercode() {
|
||||||
local p v
|
if [ $prev = ":" ]; then
|
||||||
echo $cur | IFS=':' read p v
|
appid="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
|
elif [ $cur = ":" ]; then
|
||||||
COMPREPLY=( $( compgen -P "${p}:" -W "$( while read line; do
|
appid=$prev
|
||||||
if [[ "$line" == "Build Version:"* ]]
|
cur=""
|
||||||
then
|
|
||||||
line="${line#*,}"
|
|
||||||
printf "${line%%,*} "
|
|
||||||
elif [[ "$line" == "Build:"* ]]
|
|
||||||
then
|
|
||||||
line="${line#*,}"
|
|
||||||
printf "${line%%,*} "
|
|
||||||
fi
|
fi
|
||||||
done < "metadata/${p}.yml" )" -- $cur ) )
|
versionCodes=`sed -En 's,^ +versionCode: +([0-9]+) *$,\1,p' metadata/${appid}.yml`
|
||||||
|
COMPREPLY=( $( compgen -W "$versionCodes" -- $cur ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
__complete_options() {
|
__complete_options() {
|
||||||
|
@ -91,11 +85,16 @@ __complete_build() {
|
||||||
opts="-v -q -l -s -t -f -a -w"
|
opts="-v -q -l -s -t -f -a -w"
|
||||||
|
|
||||||
lopts="--verbose --quiet --latest --stop --test --server --reset-server --skip-scan --no-tarball --force --all --wiki --no-refresh"
|
lopts="--verbose --quiet --latest --stop --test --server --reset-server --skip-scan --no-tarball --force --all --wiki --no-refresh"
|
||||||
|
case "${prev}" in
|
||||||
|
:)
|
||||||
|
__vercode
|
||||||
|
return 0;;
|
||||||
|
esac
|
||||||
case "${cur}" in
|
case "${cur}" in
|
||||||
-*)
|
-*)
|
||||||
__complete_options
|
__complete_options
|
||||||
return 0;;
|
return 0;;
|
||||||
*:*)
|
:)
|
||||||
__vercode
|
__vercode
|
||||||
return 0;;
|
return 0;;
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue