summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-05-26 17:47:54 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2013-05-27 10:19:16 +0200
commit8765d58b02c9afd00186bae4a0045dff32f7d102 (patch)
tree884cd72d4b8b2fabbd109001412e315aa908b0e8 /tools
parent538745a731d07facd7a1574c04a5d34d23ce3bfa (diff)
downloadcolobot-8765d58b02c9afd00186bae4a0045dff32f7d102.tar.gz
colobot-8765d58b02c9afd00186bae4a0045dff32f7d102.tar.bz2
colobot-8765d58b02c9afd00186bae4a0045dff32f7d102.zip
Fixed code formatting
* moved braces to new lines * fixed some function/variable names * fixed whitespace issues
Diffstat (limited to 'tools')
-rwxr-xr-xtools/fix-eof-eol.sh17
-rwxr-xr-xtools/git-grep-braces.sh4
2 files changed, 21 insertions, 0 deletions
diff --git a/tools/fix-eof-eol.sh b/tools/fix-eof-eol.sh
new file mode 100755
index 0000000..a077c85
--- /dev/null
+++ b/tools/fix-eof-eol.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Formats files to have one newline at the end of file
+
+for file in $@; do
+awk '/^$/ { ws++; next; }
+
+{
+ for (i = 0; i < ws; ++i) { print ""; }
+ print $0;
+ ws = 0;
+}
+
+END {
+ print "";
+}' $file > ${file}.out && mv ${file}.out $file
+done
diff --git a/tools/git-grep-braces.sh b/tools/git-grep-braces.sh
new file mode 100755
index 0000000..85823ab
--- /dev/null
+++ b/tools/git-grep-braces.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+# Finds all "hanging" braces
+git grep -n -E '^( *[^ ]+)+[^@]\{\s*$' -- '*.cpp' '*.h'