public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Leif Lindholm <leif.lindholm@linaro.org>, devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <liming.gao@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Philippe Mathieu-Daude <philmd@redhat.com>
Subject: [PATCH 2/3] BaseTools: Add '--quiet' option to GetMaintainer.py script
Date: Wed, 16 Oct 2019 16:09:39 +0200	[thread overview]
Message-ID: <20191016140940.18844-3-philmd@redhat.com> (raw)
In-Reply-To: <20191016140940.18844-1-philmd@redhat.com>

To have GetMaintainer.py script output easily parsable by
scripts, add the '--quiet' option. Output will be formatted
as one email per line.

Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
---
 BaseTools/Scripts/GetMaintainer.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py b/BaseTools/Scripts/GetMaintainer.py
index fbc63522db77..f26f2c5ba584 100755
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -157,6 +157,10 @@ def get_modified_files(repo, args):
 if __name__ == '__main__':
     PARSER = argparse.ArgumentParser(
         description='Retrieves information on who to cc for review on a given commit')
+    PARSER.add_argument('-q', '--quiet',
+                        action="store_true",
+                        help='Quiet mode, useful when piping the output to a script',
+                        required=False)
     PARSER.add_argument('commit',
                         action="store",
                         help='git revision to examine (default: HEAD)',
@@ -181,10 +185,11 @@ if __name__ == '__main__':
     ADDRESSES = []
 
     for file in FILES:
-        print(file)
+        if not ARGS.quiet:
+            print(file)
         addresslist = get_maintainers(file, SECTIONS)
         if addresslist:
             ADDRESSES += addresslist
 
     for address in list(OrderedDict.fromkeys(ADDRESSES)):
-        print('  %s' % address)
+        print('%s%s' % ("" if ARGS.quiet else "  ", address))
-- 
2.21.0


  parent reply	other threads:[~2019-10-16 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 14:09 [PATCH 0/3] BaseTools: Add a script to use with 'git-send-email --cc-cmd' Philippe Mathieu-Daudé
2019-10-16 14:09 ` [PATCH 1/3] BaseTools: Let the GetMaintainer.py script be executable Philippe Mathieu-Daudé
2019-10-18  1:44   ` Bob Feng
2019-10-16 14:09 ` Philippe Mathieu-Daudé [this message]
2019-10-16 14:09 ` [PATCH 3/3] BaseTools: Add script to help git-send-email pick addresses to cc Philippe Mathieu-Daudé
2019-10-16 14:12   ` Philippe Mathieu-Daudé
2019-10-16 14:49 ` [PATCH 0/3] BaseTools: Add a script to use with 'git-send-email --cc-cmd' Laszlo Ersek
2019-10-16 15:18 ` Leif Lindholm
2019-10-16 16:50   ` Philippe Mathieu-Daudé
2019-10-16 18:30     ` Stefan Hajnoczi

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-list 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=20191016140940.18844-3-philmd@redhat.com \
    --to=devel@edk2.groups.io \
    /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