mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-20 13:08:08 +07:00
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>
This commit is contained in:
parent
f11e9a1534
commit
64f77f312b
@ -126,7 +126,7 @@ if (!GetOptions(
|
|||||||
'fe|file-emails!' => \$file_emails,
|
'fe|file-emails!' => \$file_emails,
|
||||||
'f|file' => \$from_filename,
|
'f|file' => \$from_filename,
|
||||||
'v|version' => \$version,
|
'v|version' => \$version,
|
||||||
'h|help' => \$help,
|
'h|help|usage' => \$help,
|
||||||
)) {
|
)) {
|
||||||
die "$P: invalid argument - use --help if necessary\n";
|
die "$P: invalid argument - use --help if necessary\n";
|
||||||
}
|
}
|
||||||
@ -141,9 +141,9 @@ if ($version != 0) {
|
|||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($#ARGV < 0) {
|
if (-t STDIN && !@ARGV) {
|
||||||
usage();
|
# We're talking to a terminal, but have no command line arguments.
|
||||||
die "$P: argument missing: patchfile or -f file please\n";
|
die "$P: missing patchfile or -f file - use --help if necessary\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($output_separator ne ", ") {
|
if ($output_separator ne ", ") {
|
||||||
@ -165,7 +165,6 @@ if ($sections) {
|
|||||||
} else {
|
} else {
|
||||||
my $selections = $email + $scm + $status + $subsystem + $web;
|
my $selections = $email + $scm + $status + $subsystem + $web;
|
||||||
if ($selections == 0) {
|
if ($selections == 0) {
|
||||||
usage();
|
|
||||||
die "$P: Missing required option: email, scm, status, subsystem or web\n";
|
die "$P: Missing required option: email, scm, status, subsystem or web\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +172,6 @@ if ($sections) {
|
|||||||
if ($email &&
|
if ($email &&
|
||||||
($email_maintainer + $email_list + $email_subscriber_list +
|
($email_maintainer + $email_list + $email_subscriber_list +
|
||||||
$email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) {
|
$email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) {
|
||||||
usage();
|
|
||||||
die "$P: Please select at least 1 email option\n";
|
die "$P: Please select at least 1 email option\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,12 +246,18 @@ my @range = ();
|
|||||||
my @keyword_tvi = ();
|
my @keyword_tvi = ();
|
||||||
my @file_emails = ();
|
my @file_emails = ();
|
||||||
|
|
||||||
|
if (!@ARGV) {
|
||||||
|
push(@ARGV, "&STDIN");
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $file (@ARGV) {
|
foreach my $file (@ARGV) {
|
||||||
##if $file is a directory and it lacks a trailing slash, add one
|
if ($file ne "&STDIN") {
|
||||||
if ((-d $file)) {
|
##if $file is a directory and it lacks a trailing slash, add one
|
||||||
$file =~ s@([^/])$@$1/@;
|
if ((-d $file)) {
|
||||||
} elsif (!(-f $file)) {
|
$file =~ s@([^/])$@$1/@;
|
||||||
die "$P: file '${file}' not found\n";
|
} elsif (!(-f $file)) {
|
||||||
|
die "$P: file '${file}' not found\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($from_filename) {
|
if ($from_filename) {
|
||||||
push(@files, $file);
|
push(@files, $file);
|
||||||
|
Loading…
Reference in New Issue
Block a user