summaryrefslogtreecommitdiff
path: root/scripts/gst-indent-all
blob: c0580b1aed25f99818f7136c89cd3c7f946cdfc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

filter_cmd=("cat")
if test -f ".indentignore"; then
    filter_args=()
    while read -r line; do
        if test -n "$line"; then
            filter_args+=("-e" "$line")
        fi
    done < ".indentignore"
    if [[ ${#filter_args[@]} -gt 0 ]]; then
        filter_cmd=("grep" "-v" "${filter_args[@]}")
    fi
fi
git ls-files "*.c" | "${filter_cmd[@]}" | xargs -d '\n' gst-indent