mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Fixed for flag --help
This commit is contained in:
parent
42fb6bf7c5
commit
22ead694de
1 changed files with 7 additions and 5 deletions
|
@ -42,15 +42,17 @@ class Argparse:
|
|||
'--skip-installed',
|
||||
'--dependees']
|
||||
|
||||
# Check for correct flag
|
||||
for opt in self.args:
|
||||
if opt.startswith('--'):
|
||||
if opt not in self.options:
|
||||
if opt not in self.options and opt != '--help':
|
||||
raise SystemExit(f"\nError: flag '{opt}' does not exist.\n")
|
||||
|
||||
for option in self.options:
|
||||
if option in self.args:
|
||||
self.args.remove(option)
|
||||
self.flags.append(option)
|
||||
# Remove flags from args
|
||||
for opt in self.options:
|
||||
if opt in self.args:
|
||||
self.args.remove(opt)
|
||||
self.flags.append(opt)
|
||||
|
||||
def help(self):
|
||||
if len(self.args) == 1 and not self.flags:
|
||||
|
|
Loading…
Add table
Reference in a new issue