80 lines
2.7 KiB
Diff
80 lines
2.7 KiB
Diff
|
diff --git a/scripts/checkbashisms.1 b/scripts/checkbashisms.1
|
||
|
index 6df5f3c7..1075408a 100644
|
||
|
--- a/scripts/checkbashisms.1
|
||
|
+++ b/scripts/checkbashisms.1
|
||
|
@@ -44,6 +44,9 @@ which may be ignored.
|
||
|
For example, the use of "\fB$BASH_ENV\fR" may be preceded by checking
|
||
|
whether "\fB$BASH\fR" is set.
|
||
|
.TP
|
||
|
+.BR \-\-early-fail ", " \-e
|
||
|
+Exit right after a first error is seen.
|
||
|
+.TP
|
||
|
.BR \-\-version ", " \-v
|
||
|
Show version and copyright information.
|
||
|
.SH "EXIT VALUES"
|
||
|
diff --git a/scripts/checkbashisms.bash_completion b/scripts/checkbashisms.bash_completion
|
||
|
index 4ce5b521..b0e30fdf 100644
|
||
|
--- a/scripts/checkbashisms.bash_completion
|
||
|
+++ b/scripts/checkbashisms.bash_completion
|
||
|
@@ -10,7 +10,7 @@ _checkbashisms()
|
||
|
_init_completion || return
|
||
|
|
||
|
if [[ "$cur" == -* ]]; then
|
||
|
- COMPREPLY=( $( compgen -W '--newline --posix --force --extra' -- "$cur" ) )
|
||
|
+ COMPREPLY=( $( compgen -W '--newline --posix --force --extra --early-fail' -- "$cur" ) )
|
||
|
else
|
||
|
COMPREPLY=( $( compgen -o filenames -f -- "$cur" ) )
|
||
|
fi
|
||
|
diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
|
||
|
index 653ec1bb..568e2c33 100755
|
||
|
--- a/scripts/checkbashisms.pl
|
||
|
+++ b/scripts/checkbashisms.pl
|
||
|
@@ -30,7 +30,7 @@ sub init_hashes;
|
||
|
(my $progname = $0) =~ s|.*/||;
|
||
|
|
||
|
my $usage = <<"EOF";
|
||
|
-Usage: $progname [-n] [-f] [-x] script ...
|
||
|
+Usage: $progname [-n] [-f] [-x] [-e] script ...
|
||
|
or: $progname --help
|
||
|
or: $progname --version
|
||
|
This script performs basic checks for the presence of bashisms
|
||
|
@@ -47,7 +47,7 @@ You are free to redistribute this code under the terms of the
|
||
|
GNU General Public License, version 2, or (at your option) any later version.
|
||
|
EOF
|
||
|
|
||
|
-my ($opt_echo, $opt_force, $opt_extra, $opt_posix);
|
||
|
+my ($opt_echo, $opt_force, $opt_extra, $opt_posix, $opt_early_fail);
|
||
|
my ($opt_help, $opt_version);
|
||
|
my @filenames;
|
||
|
|
||
|
@@ -62,12 +62,13 @@ if (scalar(@ARGV) == 0 && (-p STDIN or -f STDIN)) {
|
||
|
$opt_help = 1 if int(@ARGV) == 0;
|
||
|
|
||
|
GetOptions(
|
||
|
- "help|h" => \$opt_help,
|
||
|
- "version|v" => \$opt_version,
|
||
|
- "newline|n" => \$opt_echo,
|
||
|
- "force|f" => \$opt_force,
|
||
|
- "extra|x" => \$opt_extra,
|
||
|
- "posix|p" => \$opt_posix,
|
||
|
+ "help|h" => \$opt_help,
|
||
|
+ "version|v" => \$opt_version,
|
||
|
+ "newline|n" => \$opt_echo,
|
||
|
+ "force|f" => \$opt_force,
|
||
|
+ "extra|x" => \$opt_extra,
|
||
|
+ "posix|p" => \$opt_posix,
|
||
|
+ "early-fail|e" => \$opt_early_fail,
|
||
|
)
|
||
|
or die
|
||
|
"Usage: $progname [options] filelist\nRun $progname --help for more details\n";
|
||
|
@@ -543,6 +544,9 @@ sub output_explanation {
|
||
|
$issues = 1;
|
||
|
} else {
|
||
|
warn "possible bashism in $filename line $. ($explanation):\n$line\n";
|
||
|
+ if ($opt_early_fail) {
|
||
|
+ exit 1;
|
||
|
+ }
|
||
|
$status |= 1;
|
||
|
}
|
||
|
}
|