summaryrefslogtreecommitdiffstats
path: root/reindent
diff options
context:
space:
mode:
authorFlorian Pritz <florian.pritz@rise-world.com>2019-04-08 13:19:07 +0200
committerFlorian Pritz <bluewind@xinu.at>2019-04-13 18:30:35 +0200
commit0da0ce428e49da5b5ee96b0699090fe503e8d563 (patch)
tree05ccb982e027b56a14e364eada67dca1fc72a1fc /reindent
parent44b7be6d4ca4b006d22b62151721141cb6e35936 (diff)
downloadbin-0da0ce428e49da5b5ee96b0699090fe503e8d563.tar.gz
bin-0da0ce428e49da5b5ee96b0699090fe503e8d563.tar.xz
Add various scripts
Signed-off-by: Florian Pritz <florian.pritz@rise-world.com>
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