From 0f467c263b1a2a815c65dc1d30bafe4fe26d9924 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 14 Nov 2017 11:53:16 +0100 Subject: [PATCH] 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 --- scripts/test-ocp-indent.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/test-ocp-indent.sh b/scripts/test-ocp-indent.sh index ab032197e..5debd7e0e 100755 --- a/scripts/test-ocp-indent.sh +++ b/scripts/test-ocp-indent.sh @@ -1,7 +1,8 @@ -#!/bin/sh +#!/bin/bash tmp_dir="$(mktemp -d -t tezos_build.XXXXXXXXXX)" failed=no +fix=${1:-""} for f in ` find \( -name _build -or \ -name .git -or \ @@ -12,7 +13,12 @@ for f in ` find \( -name _build -or \ ocp-indent $f > $tmp_dir/$ff diff -U 3 $f $tmp_dir/$ff if [ $? -ne 0 ]; then + if [ $fix = "fix" ]; then + echo "Fix indentation $f" + cp $tmp_dir/$ff $f + else failed=yes + fi fi rm -f $tmp_dir/$ff $tmp_dir/$ff.diff done