[lintian] 01/01: c/spellintian: Tolerate directories on cmd-line
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 206433281404e1f7a63672387c4d4de451f6b1d1
Author: Niels Thykier <niels@thykier.net>
Date: Sat Jun 20 00:18:27 2015 +0200
c/spellintian: Tolerate directories on cmd-line
To support the "blind" use of "spellintian *", accept directories on
the command line with "only" a warning. However, the spellintian
command will require at least one file before that it is considered a
"success" (i.e. it returns 0).
Signed-off-by: Niels Thykier <niels@thykier.net>
---
commands/spellintian.pm | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/commands/spellintian.pm b/commands/spellintian.pm
index 6fb1e75..1250085 100644
--- a/commands/spellintian.pm
+++ b/commands/spellintian.pm
@@ -58,9 +58,9 @@ sub spellcheck {
sub main {
my $profile = Lintian::Profile->new;
- Lintian::Data->set_vendor($profile);
-
my $picky = 0;
+ my $exit_code = 0;
+ Lintian::Data->set_vendor($profile);
{
local $SIG{__WARN__} = sub {
my ($message) = @_;
@@ -81,14 +81,20 @@ sub main {
my $text = slurp_entire_file(*STDIN);
spellcheck(undef, $picky, $text);
} else {
+ my $ok = 0;
for my $path (@ARGV) {
my $text;
- die("$path is a directory\n") if not -f $path;
+ if (not -f $path) {
+ print STDERR "$path is a directory\n";
+ next;
+ }
+ $ok = 1;
$text = slurp_entire_file($path);
spellcheck($path, $picky, $text);
}
+ $exit_code = 1 if not $ok;
}
- return;
+ exit($exit_code);
}
END {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: