From a33c40eb5322b464839438081d7fbc70b1010fa7 Mon Sep 17 00:00:00 2001 From: Scott Bahling Date: Fri, 10 Jan 2014 13:04:45 +0100 Subject: [PATCH] Fix handling of meta command within local working directory * Fix osc ignoring -A apiurl command option when arguments are less than 2 and executed within local working copy * Enhance handling of meta command within local working copy. - meta prj: Try to use project and apiurl of local working copy if no arguments are passed - meta pkg: Try to use project and apiurl of local working copy if one argument is passed (single argument assumed to be package name), and try to use project, package and apiurl if no arguments are passed --- osc/commandline.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 912c4374..1775eacb 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -731,22 +731,30 @@ class Osc(cmdln.Cmdln): raise oscerr.WrongArgs('Too many arguments.') apiurl = self.get_api_url() - if len(args) < 2: - apiurl = store_read_apiurl(os.curdir) - # specific arguments + # Specific arguments + # + # If project or package arguments missing, assume to work + # with project and/or package in current local directory. attributepath = [] - if cmd in ['pkg', 'prj', 'prjconf' ]: - if len(args) == 0: + if cmd in ['prj', 'prjconf']: + if len(args) < 1: + apiurl = store_read_apiurl(os.curdir) project = store_read_project(os.curdir) else: project = args[0] - if cmd == 'pkg': - if len(args) < 2: + elif cmd == 'pkg': + if len(args) < 2: + apiurl = store_read_apiurl(os.curdir) + project = store_read_project(os.curdir) + if len(args) < 1: package = store_read_package(os.curdir) else: - package = args[1] + package = args[0] + else: + project = args[0] + package = args[1] elif cmd == 'attribute': project = args[0]