aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-03-05 16:43:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-06 14:26:34 -0500
commit64f77f312b15f101bf6c4c65d5359ccc16e3f82b (patch)
tree1198f9bb27e6e33c8e8b4dc025ef8f73bba5731a /scripts
parentf11e9a1534c5e9dd4be97b30e6b24902e0ec325b (diff)
scripts/get_maintainer.pl: add ability to read from STDIN
Doesn't need or accept '-' as a trailing option to read stdin. Doesn't print usage() after bad options. Adds --usage as command line equivalent of --help Suggested-by: Borislav Petkov <petkovbb@googlemail.com> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get_maintainer.pl26
1 files changed, 15 insertions, 11 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 4cd83fae87ca..f8baeeb8c3f7 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -126,7 +126,7 @@ if (!GetOptions(
126 'fe|file-emails!' => \$file_emails, 126 'fe|file-emails!' => \$file_emails,
127 'f|file' => \$from_filename, 127 'f|file' => \$from_filename,
128 'v|version' => \$version, 128 'v|version' => \$version,
129 'h|help' => \$help, 129 'h|help|usage' => \$help,
130 )) { 130 )) {
131 die "$P: invalid argument - use --help if necessary\n"; 131 die "$P: invalid argument - use --help if necessary\n";
132} 132}
@@ -141,9 +141,9 @@ if ($version != 0) {
141 exit 0; 141 exit 0;
142} 142}
143 143
144if ($#ARGV < 0) { 144if (-t STDIN && !@ARGV) {
145 usage(); 145 # We're talking to a terminal, but have no command line arguments.
146 die "$P: argument missing: patchfile or -f file please\n"; 146 die "$P: missing patchfile or -f file - use --help if necessary\n";
147} 147}
148 148
149if ($output_separator ne ", ") { 149if ($output_separator ne ", ") {
@@ -165,7 +165,6 @@ if ($sections) {
165} else { 165} else {
166 my $selections = $email + $scm + $status + $subsystem + $web; 166 my $selections = $email + $scm + $status + $subsystem + $web;
167 if ($selections == 0) { 167 if ($selections == 0) {
168 usage();
169 die "$P: Missing required option: email, scm, status, subsystem or web\n"; 168 die "$P: Missing required option: email, scm, status, subsystem or web\n";
170 } 169 }
171} 170}
@@ -173,7 +172,6 @@ if ($sections) {
173if ($email && 172if ($email &&
174 ($email_maintainer + $email_list + $email_subscriber_list + 173 ($email_maintainer + $email_list + $email_subscriber_list +
175 $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { 174 $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) {
176 usage();
177 die "$P: Please select at least 1 email option\n"; 175 die "$P: Please select at least 1 email option\n";
178} 176}
179 177
@@ -248,12 +246,18 @@ my @range = ();
248my @keyword_tvi = (); 246my @keyword_tvi = ();
249my @file_emails = (); 247my @file_emails = ();
250 248
249if (!@ARGV) {
250 push(@ARGV, "&STDIN");
251}
252
251foreach my $file (@ARGV) { 253foreach my $file (@ARGV) {
252 ##if $file is a directory and it lacks a trailing slash, add one 254 if ($file ne "&STDIN") {
253 if ((-d $file)) { 255 ##if $file is a directory and it lacks a trailing slash, add one
254 $file =~ s@([^/])$@$1/@; 256 if ((-d $file)) {
255 } elsif (!(-f $file)) { 257 $file =~ s@([^/])$@$1/@;
256 die "$P: file '${file}' not found\n"; 258 } elsif (!(-f $file)) {
259 die "$P: file '${file}' not found\n";
260 }
257 } 261 }
258 if ($from_filename) { 262 if ($from_filename) {
259 push(@files, $file); 263 push(@files, $file);