From 022578925b9d1cd3b771d43029df42e42b22aab0 Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Mon, 11 Apr 2011 15:07:56 +0200 Subject: [PATCH 1/2] osc ls . (shortcut for PROJECT PACKAGE from current dir.) --- osc/commandline.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osc/commandline.py b/osc/commandline.py index ff85f729..6dda2bec 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -236,6 +236,7 @@ class Osc(cmdln.Cmdln): Examples for listing sources: ls # list all projects (deprecated) ls / # list all projects + ls . # take PROJECT/PACKAGE from current dir. ls PROJECT # list packages in a project ls PROJECT PACKAGE # list source files of package of a project ls PROJECT PACKAGE # list if this file exists @@ -274,12 +275,19 @@ class Osc(cmdln.Cmdln): fname = None if len(args) == 0: # For consistency with *all* other commands - # this list what the server has in the current wd. + # this lists what the server has in the current wd. # CAUTION: 'osc ls -b' already works like this. pass if len(args) > 0: project = args[0] if project == '/': project = None + if project == '.': + cwd = os.getcwd() + if is_project_dir(cwd): + project = store_read_project(cwd) + elif is_package_dir(cwd): + project = store_read_project(cwd) + package = store_read_package(cwd) if len(args) > 1: package = args[1] if opts.deleted: From 21d96a4a17addf03ea9fa62b13e251c5f8a0539e Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Mon, 11 Apr 2011 20:48:59 +0200 Subject: [PATCH 2/2] added new command: osc who [login] --- osc/commandline.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osc/commandline.py b/osc/commandline.py index 6dda2bec..0e4673c6 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -5922,6 +5922,25 @@ Please submit there instead, or use --nodevelproject to force direct submission. print ', '.join(maintainers.get(role, [])) or '-' print + @cmdln.alias('who') + @cmdln.alias('user') + def do_whois(self, subcmd, opts, *args): + """${cmd_name}: Show fullname and email of a buildservice user + + ${cmd_usage} + ${cmd_option_list} + """ + apiurl = self.get_api_url() + if len(args) > 1: + raise oscerr.WrongArgs('Wrong number of arguments.') + if len(args) < 1: + if not conf.config['api_host_options'][apiurl].has_key('user'): + raise oscerr.WrongArgs('your .oscrc does not have your user name.') + args = (conf.config['api_host_options'][apiurl]['user'],) + user = get_user_data(apiurl, args[0], 'login', 'realname', 'email') + if len(user) > 0: user[1] = '"'+user[1]+'"' + print " ".join(user), "\n" + @cmdln.option('-r', '--revision', metavar='rev', help='print out the specified revision')