Add tools dir. New tool: categorycount

This commit is contained in:
Daniel Martí 2013-09-18 00:11:35 +02:00
parent eb7d2dceab
commit 42285e560a
2 changed files with 32 additions and 0 deletions

30
tools/categorycount Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
# Sorts categories by number of apps in them, discards disabled apps
declare -A count
for file in metadata/*.txt
do
while read line
do
[[ "$line" == "Disabled:"* ]] && break
if [[ "$line" == "Category:"* ]]
then
while IFS=';' read -ra categ
do
count[$categ]=$(( ${count[$categ]} + 1 )) || count[$categ]=1
done <<< "${line:9}"
break
fi
done < $file
done
output=""
for category in "${!count[@]}"
do
output+="${count[$category]}_$category\n"
done
echo -en "$output" | column -t -s '_' | sort -n

40
tools/commitupdates Executable file
View file

@ -0,0 +1,40 @@
#!/bin/bash
# Commits updates to apps, allowing you to edit the commit messages
commands=()
while read line; do
if [[ "$line" == *M*metadata/*.txt ]]; then
file=${line##* }
newbuild=0
while read l; do
if [[ "$l" == "+Build Version:"* ]]; then
newbuild=1
build=${l#*:}
version=${build%%,*}
build=${build#*,}
vercode=${build%%,*}
fi
done < <(git diff HEAD -- "$file")
[ $newbuild -eq 0 ] && continue
while read l; do
[[ "$l" == "Auto Name:"* ]] && name=${l##*:}
done < "$file"
id=${file##*/}
id=${id%.txt*}
[ -d metadata/$id ] && extra=metadata/$id
[ -n "$name" ] && id="$name ($id)"
commands+=("git commit -m 'Update $id to $version ($vercode)' -e -- $file $extra")
fi
done < <(git status --porcelain)
for cmd in "${commands[@]}"; do
eval "$cmd"
done