1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-04 22:53:42 +02:00

new command 'maintainer'

This commit is contained in:
Dr. Peter Poeml
2007-09-03 10:17:26 +00:00
parent 1546410722
commit 27cee26d4a

View File

@@ -1830,6 +1830,43 @@ class Osc(cmdln.Cmdln):
sys.stdout.write(out)
@cmdln.option('-e', '--email', action='store_true',
help='show email addresses instead of user names')
def do_maintainer(self, subcmd, opts, *args):
"""${cmd_name}: Show maintainers of a project/package
To be used like this:
osc maintainer PRJ
or
osc maintainer PRJ PKG
${cmd_usage}
${cmd_option_list}
"""
if len(args) == 1:
m = show_project_meta(conf.config['apiurl'], args[0])
elif len(args) == 2:
m = show_package_meta(conf.config['apiurl'], args[0], args[1])
else:
sys.exit('wrong argument count')
maintainers = []
tree = ET.parse(StringIO(''.join(m)))
for person in tree.findall('person'):
maintainers.append(person.get('userid'))
if not opts.email:
print ', '.join(maintainers)
else:
emails = []
for maintainer in maintainers:
emails.append(get_user_email(conf.config['apiurl'], maintainer))
print ', '.join(emails)
# fini!
###############################################################################