summaryrefslogtreecommitdiffstats
path: root/reindent
diff options
context:
space:
mode:
Diffstat (limited to 'reindent')
-rwxr-xr-xreindent13
1 files changed, 13 insertions, 0 deletions
diff --git a/reindent b/reindent
new file mode 100755
index 0000000..9237ae2
--- /dev/null
+++ b/reindent
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+if [[ $# < 3 ]]; then
+ echo "usage: reindent <from space count> <to space count> <file> ..."
+ exit 1
+fi
+
+from=$1; shift
+to=$1; shift
+
+for file in "$@"; do
+ unexpand -t "$from" "$file" | expand -i -t "$to" | sponge "$file"
+done