public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ian Cowan <ian@linux.cowan.aero>
To: Ozgur Karatas <ozgurk@ieee.org>
Cc: linux-kernel@vger.kernel.org, Joe Perches <joe@perches.com>
Subject: Re: [PATCH] scripts: get_maintainer: add an option to format for command line
Date: Sat, 23 Apr 2022 16:26:10 -0400	[thread overview]
Message-ID: <YmRg4m2yOCeiOv8E@fedora> (raw)
In-Reply-To: <CAADfD8yJGBJz03+j16Z2EmEwkB_vXf6920NY0LLTFMNvq092uw@mail.gmail.com>

On Sat, Apr 23, 2022 at 11:20:54PM +0400, Ozgur Karatas wrote:
> On Sat, Apr 23, 2022 at 10:56 PM Ian Cowan <ian@linux.cowan.aero> wrote:
> 
> > This adds the option to return the list of maintainers in the format for
> > sending via command line, specifically targeted for `git send-email`.
> > This will add a `--to` tag before the first email and a `--cc` tag for
> > each following email. The option can be toggled by using the
> > `--cl-format` flag when calling the get_maintainer script.
> >
> > The new addition is disabled by default and will only print (even if
> > enabled) if there are maintainers to return. This will prevent the
> > script from trying to generate a formatted line without any maintainers
> > and also allow the user to visually verify that the outputted line contains
> > the correct maintainers and lists (by verifying the roles).
> >
> >
> Hello,
> 
> actually i have been using easier wrapper commands for a long time now, so
> what say Joe is right.
> get_maintainer.pl script will get all emails and just add them git
> send-email --to or --cc
> 
> Regards
> 

Sounds good, I will go about it this way!

Ian

> 
> 
> > Signed-off-by: Ian Cowan <ian@linux.cowan.aero>
> > ---
> >  scripts/get_maintainer.pl | 29 +++++++++++++++++++++++++++--
> >  1 file changed, 27 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> > index 6bd5221d37b8..fc6844a56c87 100755
> > --- a/scripts/get_maintainer.pl
> > +++ b/scripts/get_maintainer.pl
> > @@ -53,6 +53,7 @@ my $output_section_maxlen = 50;
> >  my $scm = 0;
> >  my $tree = 1;
> >  my $web = 0;
> > +my $format_for_cl = 0;
> >  my $subsystem = 0;
> >  my $status = 0;
> >  my $letters = "";
> > @@ -269,6 +270,7 @@ if (!GetOptions(
> >                 'scm!' => \$scm,
> >                 'tree!' => \$tree,
> >                 'web!' => \$web,
> > +               'cl-format!' => \$format_for_cl,
> >                 'letters=s' => \$letters,
> >                 'pattern-depth=i' => \$pattern_depth,
> >                 'k|keywords!' => \$keywords,
> > @@ -636,8 +638,13 @@ my %deduplicate_address_hash = ();
> >
> >  my @maintainers = get_maintainers();
> >  if (@maintainers) {
> > -    @maintainers = merge_email(@maintainers);
> > -    output(@maintainers);
> > +       my @maintainers_merged = merge_email(@maintainers);
> > +       output(@maintainers_merged);
> > +
> > +       if ($format_for_cl) {
> > +               my @format_for_cl = format_cl(@maintainers);
> > +               output(@format_for_cl);
> > +       }
> >  }
> >
> >  if ($scm) {
> > @@ -1071,6 +1078,7 @@ Output type options:
> >    --separator [, ] => separator for multiple entries on 1 line
> >      using --separator also sets --nomultiline if --separator is not [, ]
> >    --multiline => print 1 entry per line
> > +  --cl-format => Include a formatted string for emailing via the command
> > line
> >
> >  Other options:
> >    --pattern-depth => Number of pattern directory traversals (default: 0
> > (all))
> > @@ -2512,6 +2520,23 @@ sub merge_email {
> >      return @lines;
> >  }
> >
> > +sub format_cl {
> > +       my @out;
> > +       my $first = 1;
> > +
> > +       for (@_) {
> > +               my ($address, $role) = @$_;
> > +               if ($first) {
> > +                       $first = 0;
> > +                       @out = "--to '$address'";
> > +               } else {
> > +                       @out = "@out --cc '$address'";
> > +               }
> > +       }
> > +
> > +       return ('', @out);
> > +}
> > +
> >  sub output {
> >      my (@parms) = @_;
> >
> > --
> > 2.35.1
> >
> >

      parent reply	other threads:[~2022-04-23 20:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23 18:55 [PATCH] scripts: get_maintainer: add an option to format for command line Ian Cowan
2022-04-23 19:02 ` Joe Perches
     [not found] ` <CAADfD8yJGBJz03+j16Z2EmEwkB_vXf6920NY0LLTFMNvq092uw@mail.gmail.com>
2022-04-23 20:26   ` Ian Cowan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YmRg4m2yOCeiOv8E@fedora \
    --to=ian@linux.cowan.aero \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ozgurk@ieee.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox