Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3d9fd1a

Browse files
committed
Allow and require passing files on command line of pgperltidy
pgperltidy as well as pgperlcritic and pgperlsyncheck now allow passing files and directories on the command line, like pgindent does. (Previously, they would always operate on the whole tree.) Also, for consistency with pgindent's new behavior (as of b16259b), passing an argument is now required. To get the previous default behavior, use "pgperltidy ." for example. Discussion: https://www.postgresql.org/message-id/flat/45aacd8a-5265-d9da-8df2-b8e2c0cf6a07%40eisentraut.org
1 parent 8cca660 commit 3d9fd1a

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

src/tools/perlcheck/find_perl_files

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
# shell function to find all perl files in the source tree
44

55
find_perl_files () {
6+
if [ $# -eq 0 ]; then
7+
echo 'No files to process' 1>&2
8+
return
9+
fi
610
{
711
# take all .pl and .pm files
8-
find . -type f -name '*.p[lm]' -print
12+
find "$@" -type f -name '*.p[lm]' -print
913
# take executable files that file(1) thinks are perl files
10-
find . -type f -perm -100 -exec file {} \; -print |
14+
find "$@" -type f -perm -100 -exec file {} \; -print |
1115
egrep -i ':.*perl[0-9]*\>' |
1216
cut -d: -f1
1317
} | sort -u | grep -v '^\./\.git/'

src/tools/perlcheck/pgperlcritic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PERLCRITIC=${PERLCRITIC:-perlcritic}
1414

1515
. src/tools/perlcheck/find_perl_files
1616

17-
find_perl_files | xargs $PERLCRITIC \
17+
find_perl_files "$@" | xargs $PERLCRITIC \
1818
--quiet \
1919
--program-extensions .pl \
2020
--profile=src/tools/perlcheck/perlcriticrc

src/tools/perlcheck/pgperlsyncheck

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ set -e
1313
# for zsh
1414
setopt shwordsplit 2>/dev/null || true
1515

16-
find_perl_files | xargs -L 1 perl $INCLUDES -cw 2>&1 | grep -v OK
16+
find_perl_files "$@" | xargs -L 1 perl $INCLUDES -cw 2>&1 | grep -v OK

src/tools/pgindent/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ DOING THE INDENT RUN:
4545

4646
4) Indent the Perl code using perltidy:
4747

48-
src/tools/pgindent/pgperltidy
48+
src/tools/pgindent/pgperltidy .
4949

5050
If you want to use some perltidy version that's not in your PATH,
5151
first set the PERLTIDY environment variable to point to it.

src/tools/pgindent/pgperltidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ PERLTIDY=${PERLTIDY:-perltidy}
99

1010
. src/tools/perlcheck/find_perl_files
1111

12-
find_perl_files | xargs $PERLTIDY --profile=src/tools/pgindent/perltidyrc
12+
find_perl_files "$@" | xargs $PERLTIDY --profile=src/tools/pgindent/perltidyrc

0 commit comments

Comments
 (0)