Scripts: Add optional 'fix' argument to test-ocp-indent.sh
the script can be called with fix as argument to fix all indentation problems in one go
This commit is contained in:
parent
102ba49149
commit
0f467c263b
@ -1,7 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
tmp_dir="$(mktemp -d -t tezos_build.XXXXXXXXXX)"
|
tmp_dir="$(mktemp -d -t tezos_build.XXXXXXXXXX)"
|
||||||
failed=no
|
failed=no
|
||||||
|
fix=${1:-""}
|
||||||
|
|
||||||
for f in ` find \( -name _build -or \
|
for f in ` find \( -name _build -or \
|
||||||
-name .git -or \
|
-name .git -or \
|
||||||
@ -12,8 +13,13 @@ for f in ` find \( -name _build -or \
|
|||||||
ocp-indent $f > $tmp_dir/$ff
|
ocp-indent $f > $tmp_dir/$ff
|
||||||
diff -U 3 $f $tmp_dir/$ff
|
diff -U 3 $f $tmp_dir/$ff
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
if [ $fix = "fix" ]; then
|
||||||
|
echo "Fix indentation $f"
|
||||||
|
cp $tmp_dir/$ff $f
|
||||||
|
else
|
||||||
failed=yes
|
failed=yes
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
rm -f $tmp_dir/$ff $tmp_dir/$ff.diff
|
rm -f $tmp_dir/$ff $tmp_dir/$ff.diff
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user