summaryrefslogtreecommitdiff
path: root/scripts/gst-indent-all
blob: 556dd19eecba558f35178ac6d639b00f01e01fdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

BASEDIR=$(dirname $0)


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' $BASEDIR/gst-indent

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