1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-08 20:15:47 +01:00

whois: display user info suitable for c&p in mail client

allow multiple arguments
This commit is contained in:
Ludwig Nussel 2011-09-20 15:24:46 +02:00
parent 842df7e511
commit f760282ea4

View File

@ -6462,22 +6462,21 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.alias('who') @cmdln.alias('who')
@cmdln.alias('user') @cmdln.alias('user')
def do_whois(self, subcmd, opts, *args): def do_whois(self, subcmd, opts, *usernames):
"""${cmd_name}: Show fullname and email of a buildservice user """${cmd_name}: Show fullname and email of a buildservice user
${cmd_usage} ${cmd_usage}
${cmd_option_list} ${cmd_option_list}
""" """
apiurl = self.get_api_url() apiurl = self.get_api_url()
if len(args) > 1: if len(usernames) < 1:
raise oscerr.WrongArgs('Wrong number of arguments.')
if len(args) < 1:
if not conf.config['api_host_options'][apiurl].has_key('user'): if not conf.config['api_host_options'][apiurl].has_key('user'):
raise oscerr.WrongArgs('your .oscrc does not have your user name.') raise oscerr.WrongArgs('your .oscrc does not have your user name.')
args = (conf.config['api_host_options'][apiurl]['user'],) usernames = (conf.config['api_host_options'][apiurl]['user'],)
user = get_user_data(apiurl, args[0], 'login', 'realname', 'email') for name in usernames:
if len(user) > 0: user[1] = '"'+user[1]+'"' user = get_user_data(apiurl, name, 'login', 'realname', 'email')
print " ".join(user), "\n" if len(user) == 3:
print "%s: \"%s\" <%s>"%(user[0], user[1], user[2])
@cmdln.option('-r', '--revision', metavar='rev', @cmdln.option('-r', '--revision', metavar='rev',