[PATCH] get_maintainer: Add --cc option

From: Sebastian Andrzej Siewior
Date: Mon Jun 24 2019 - 09:03:32 EST


The --cc adds a Cc: prefix infront of the email address so it can be
used by other Scripts directly instead of adding another wrapper for
this.

Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
scripts/get_maintainer.pl | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index c1c088ef1420e..7f812d23218e5 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -46,6 +46,8 @@ my $output_multiline = 1;
my $output_separator = ", ";
my $output_roles = 0;
my $output_rolestats = 1;
+my $output_cc_prefix = 0;
+my $cc_prefix = "";
my $output_section_maxlen = 50;
my $scm = 0;
my $tree = 1;
@@ -252,6 +254,7 @@ if (!GetOptions(
'multiline!' => \$output_multiline,
'roles!' => \$output_roles,
'rolestats!' => \$output_rolestats,
+ 'cc!' => \$output_cc_prefix,
'separator=s' => \$output_separator,
'subsystem!' => \$subsystem,
'status!' => \$status,
@@ -298,6 +301,10 @@ $output_multiline = 0 if ($output_separator ne ", ");
$output_rolestats = 1 if ($interactive);
$output_roles = 1 if ($output_rolestats);

+if ($output_cc_prefix) {
+ $cc_prefix = "Cc: ";
+}
+
if ($sections || $letters ne "") {
$sections = 1;
$email = 0;
@@ -2462,9 +2469,9 @@ sub merge_email {
my ($address, $role) = @$_;
if (!$saw{$address}) {
if ($output_roles) {
- push(@lines, "$address ($role)");
+ push(@lines, "$cc_prefix" . "$address ($role)");
} else {
- push(@lines, $address);
+ push(@lines, "$cc_prefix" . "$address");
}
$saw{$address} = 1;
}
--
2.20.1