mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-05 08:46:20 +01:00
Fixed for flags
This commit is contained in:
parent
777694d063
commit
803cefe223
1 changed files with 14 additions and 2 deletions
|
@ -45,7 +45,7 @@ class Argparse:
|
|||
# Check for correct flag
|
||||
for opt in self.args:
|
||||
if opt.startswith('--'):
|
||||
if opt not in self.options and opt != '--help':
|
||||
if opt not in self.options and opt not in ['--help', '--version']:
|
||||
raise SystemExit(f"\nError: flag '{opt}' does not exist.\n")
|
||||
|
||||
# Remove flags from args
|
||||
|
@ -74,6 +74,9 @@ class Argparse:
|
|||
self.usage.help(1)
|
||||
|
||||
def upgrade(self):
|
||||
if [f for f in self.flags if f not in self.options[:-2]]:
|
||||
self.usage.help(1)
|
||||
|
||||
if len(self.args) == 1:
|
||||
self.check.database()
|
||||
|
||||
|
@ -99,7 +102,10 @@ class Argparse:
|
|||
self.usage.help(1)
|
||||
|
||||
def build(self):
|
||||
if len(self.args) >= 2 and '--reinstall' not in self.flags:
|
||||
if [f for f in self.flags if f not in self.options[:-3]]:
|
||||
self.usage.help(1)
|
||||
|
||||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
|
@ -112,6 +118,9 @@ class Argparse:
|
|||
self.usage.help(1)
|
||||
|
||||
def install(self):
|
||||
if [f for f in self.flags if f not in self.options[:-1]]:
|
||||
self.usage.help(1)
|
||||
|
||||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
|
@ -154,6 +163,9 @@ class Argparse:
|
|||
self.usage.help(1)
|
||||
|
||||
def view(self):
|
||||
if [f for f in self.flags if f not in self.options[5]]:
|
||||
self.usage.help(1)
|
||||
|
||||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue