diff options
author | Daniel Hahler <git@thequod.de> | 2017-04-27 22:09:23 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2017-04-27 22:09:23 +0200 |
commit | 236da0605066febea0c762efdfa9c3da7c52354f (patch) | |
tree | 9fa2c5e18ba978cb38edca14e2a8c91a30ec646b /custom-checks | |
parent | 10679b29c31bd3843adb6ae6082cb56e40d4fda6 (diff) | |
download | ale-236da0605066febea0c762efdfa9c3da7c52354f.zip |
custom-checks: handle multiple dirs
This also fixes a [shellcheck issue](https://github.com/koalaman/shellcheck/wiki/SC2013).
Diffstat (limited to 'custom-checks')
-rwxr-xr-x | custom-checks | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/custom-checks b/custom-checks index 440dafe5..37d2840c 100755 --- a/custom-checks +++ b/custom-checks @@ -44,24 +44,26 @@ fi shopt -s globstar -directory="$1" +directories=("$@") check_errors() { regex="$1" message="$2" - for match in $( - grep -n "$regex" "$directory"/**/*.vim \ - | grep -o '^[^:]\+:[0-9]\+' \ - | sed 's:^\./::' - ); do - RETURN_CODE=1 - echo "$match $message" + for directory in "${directories[@]}"; do + while IFS= read -r match; do + RETURN_CODE=1 + echo "$match $message" + done < <(grep -n "$regex" "$directory"/**/*.vim \ + | grep -o '^[^:]\+:[0-9]\+' \ + | sed 's:^\./::') done } if (( FIX_ERRORS )); then - sed -i "s/^\(function.*)\) *$/\1 abort/" "$directory"/**/*.vim + for directory in "${directories[@]}"; do + sed -i "s/^\(function.*)\) *$/\1 abort/" "$directory"/**/*.vim + done fi check_errors \ |