Fixed arguments with flags

This commit is contained in:
Dimitris Zlatanidis 2022-06-23 23:57:43 +03:00
parent 94fc303bb7
commit 78d6b0916b

View file

@ -32,13 +32,13 @@ class Argparse:
def flag(self):
self.flags = []
options = ['--yes',
'--jobs',
'--resolve-off',
'--reinstall'
]
self.options = ['--yes',
'--jobs',
'--resolve-off',
'--reinstall'
]
for option in options:
for option in self.options:
if option in self.args:
self.args.remove(option)
self.flags.append(option)
@ -63,7 +63,7 @@ class Argparse:
usage(1)
def build(self):
if len(self.args) >= 2:
if len(self.args) >= 2 and '--reinstall' not in self.flags:
packages = list(set(self.args[1:]))
self.check.exists(packages)
@ -87,6 +87,9 @@ class Argparse:
usage(1)
def remove(self):
if [f for f in self.flags if f in self.options[1:]]:
usage(1)
if len(self.args) >= 2:
packages = list(set(self.args[1:]))
packages = self.check.blacklist(packages)
@ -99,6 +102,9 @@ class Argparse:
usage(1)
def search(self):
if [f for f in self.flags if f in self.options]:
usage(1)
if len(self.args) >= 2:
packages = list(set(self.args[1:]))
packages = self.check.blacklist(packages)
@ -111,6 +117,9 @@ class Argparse:
usage(1)
def find(self):
if [f for f in self.flags if f in self.options]:
usage(1)
if len(self.args) >= 2:
packages = list(set(self.args[1:]))
packages = self.check.blacklist(packages)