mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +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() {
|
||||
local p v
|
||||
echo $cur | IFS=':' read p v
|
||||
|
||||
COMPREPLY=( $( compgen -P "${p}:" -W "$( while read line; do
|
||||
if [[ "$line" == "Build Version:"* ]]
|
||||
then
|
||||
line="${line#*,}"
|
||||
printf "${line%%,*} "
|
||||
elif [[ "$line" == "Build:"* ]]
|
||||
then
|
||||
line="${line#*,}"
|
||||
printf "${line%%,*} "
|
||||
fi
|
||||
done < "metadata/${p}.yml" )" -- $cur ) )
|
||||
if [ $prev = ":" ]; then
|
||||
appid="${COMP_WORDS[COMP_CWORD-2]}"
|
||||
elif [ $cur = ":" ]; then
|
||||
appid=$prev
|
||||
cur=""
|
||||
fi
|
||||
versionCodes=`sed -En 's,^ +versionCode: +([0-9]+) *$,\1,p' metadata/${appid}.yml`
|
||||
COMPREPLY=( $( compgen -W "$versionCodes" -- $cur ) )
|
||||
}
|
||||
|
||||
__complete_options() {
|
||||
|
@ -91,11 +85,16 @@ __complete_build() {
|
|||
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"
|
||||
case "${prev}" in
|
||||
:)
|
||||
__vercode
|
||||
return 0;;
|
||||
esac
|
||||
case "${cur}" in
|
||||
-*)
|
||||
__complete_options
|
||||
return 0;;
|
||||
*:*)
|
||||
:)
|
||||
__vercode
|
||||
return 0;;
|
||||
*)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue