From eeddc7ea82ec457e0ef7880fcf0a7deb3ede06fd Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 22 Jan 2016 00:41:58 +0200 Subject: [PATCH] Update positions arguments for tracking deps --- slpkg/main.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index c5c26766..f8672359 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -362,21 +362,22 @@ class ArgParse(object): "--graph=", "--case-ins" ] - if (len(self.args) >= 3 and len(self.args) < 6 and - self.args[0] in options): - if self.args[1] in self.meta.repositories: - for arg in self.args[3:]: - if arg.startswith(additional_options[1]): - flag.append(arg) - arg = "" - if arg in additional_options: - flag.append(arg) - if arg and arg not in additional_options: - usage("") - raise SystemExit() - TrackingDeps(self.args[2], self.args[1], flag).run() - else: - usage(self.args[1]) + for arg in self.args: + if arg.startswith(additional_options[1]): + flag.append(arg) + self.args.remove(arg) + if arg in additional_options: + flag.append(arg) + # clean addition options from args + for f in flag: + if f in self.args: + self.args.remove(f) + if (len(self.args) >= 3 and self.args[0] in options and + self.args[1] in self.meta.repositories): + TrackingDeps(self.args[2], self.args[1], flag).run() + elif (len(self.args) >= 2 and + self.args[1] not in self.meta.repositories): + usage(self.args[1]) else: usage("")