File: tidy

package info (click to toggle)
libmojo-ioloop-readwriteprocess-perl 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 540 kB
  • sloc: perl: 4,655; sh: 101; makefile: 2
file content (40 lines) | stat: -rwxr-xr-x 775 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
#!/bin/bash

#
# perltidy rules can be found in ../.perltidyrc
#

check=
if test "$1"  = '--check'; then
    shift
    check=1
fi

if ! which perltidy > /dev/null 2>&1; then
    echo "No perltidy found, install it first!"
    exit 1
fi

cd "${0%/*}/.."

# just to make sure we are at the right location
test -e tools/tidy || exit 1

find . -name '*.tdy' -delete

find . \( -name '*.p[lm]' -o -name '*.t' \) -print0 | xargs -0 perltidy --pro=.../.perltidyrc

while read file; do
    if ! diff -u ${file%.tdy} $file; then
        if test -n "$check"; then
            echo "RUN tools/tidy script before checkin"
            exit 1
        else
            mv -v $file ${file%.tdy}
        fi
    else
        rm $file
    fi
done < <(find . -name "*.tdy")

# vim: set sw=4 et: