kde-extraapps/kuassel/scripts/manage/format_source.sh
Ivailo Monev 3a9271bd44 import modified version of quassel as kuassel
the version imported is based on upstream 9c5fd60 with its bundled
copies of miniz (alternative to zlib), oxygen icons and other
non-relevant cruft removed. KDE integreation hardcoded having in
mind it will improve (icons handling, browser integration, etc.)
rebranding is not done yet and credits to the original authors and
contributors are and will be left mostly intact with the exception
of adding new.
2014-12-29 00:56:55 +00:00

32 lines
807 B
Bash
Executable file

#!/bin/sh
# format_source.sh dirname - indent the whole source tree
# format_source.sh filename - indent a single file
if [ -d "$1" ]; then
#echo "Dir ${1} exists"
file_list=`find ${1} -name "*.cpp" -or -name "*.h" -type f`
for file2indent in $file_list
do
echo "Indenting file $file2indent"
#!/bin/bash
uncrustify -f "$file2indent" -c "./format_source.cfg" -o indentoutput.tmp
mv indentoutput.tmp "$file2indent"
done
else
if [ -f "$1" ]; then
echo "Indenting one file $1"
#!/bin/bash
uncrustify -f "$1" -c "./format_source.cfg" -o indentoutput.tmp
mv indentoutput.tmp "$1"
else
echo "ERROR: As parameter given directory or file does not exist!"
echo "Syntax is: format_source.sh dirname filesuffix"
echo "Syntax is: format_source.sh filename"
echo "Example: format_source.sh temp cpp"
exit 1
fi
fi