stylish.sh: a script to format source code via astyle

This commit is contained in:
Ivailo Monev 2015-02-27 13:03:08 +00:00
parent 548fa47b03
commit dcc731d37a

25
stylish.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
set -e
cwd="$(pwd)"
if ! type -p astyle ;then
echo "astyle is not installed"
exit 1
fi
packs=("kdelibs" "kde-baseapps" "kde-workspace" "kde-extraapps")
source "$(dirname $0)/fetch.sh"
for p in "${packs[@]}";do
echo "Adjusting formatting of $p..."
cd "$cwd/$p"
# git reset --hard HEAD
astyle --style=1tbs --convert-tabs --indent=spaces=4 --verbose \
$(find -type f -name '*.c' -o -name '*.cc' -o -name '*.cpp' \
-o -name '*.h' -o -name '*.hh' -o -name '*.hpp')
cd "$cwd"
git clean -f
done