BaseTools/GetMaintainer.py: Add GitHub username argument

Adds a new `-g` parameter so that output will also include the GitHub
username.

This change uses a simple regular expression as opposed to directly
returning the original line from the file to make the extraction of
GitHub usernames more robust to other changes on the line in the
maintainers text file.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
Michael Kubacki 2024-07-22 17:14:55 -04:00 committed by mergify[bot]
parent a96d2a8f2d
commit 3f0c4cee94

View File

@ -179,6 +179,10 @@ if __name__ == '__main__':
PARSER.add_argument('-l', '--lookup',
help='Find section matches for path LOOKUP',
required=False)
PARSER.add_argument('-g', '--github',
action='store_true',
help='Include GitHub usernames in output',
required=False)
ARGS = PARSER.parse_args()
REPO = SetupGit.locate_repo()
@ -203,5 +207,8 @@ if __name__ == '__main__':
for address in ADDRESSES:
if '<' in address and '>' in address:
address = address.split('>', 1)[0] + '>'
print(' %s' % address)
address, github_id = address.split('>', 1)
address = address + '>'
github_id = github_id.strip() if ARGS.github else ''
print(' %s %s' % (address, github_id))