1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-17 01:32:37 +02:00

don't reset sys.argv anymore. check for 'valid_command' instead

This commit is contained in:
Kelly Brazil
2021-05-10 18:58:45 -07:00
parent da904e4770
commit 0d7d7951f8

View File

@ -430,9 +430,6 @@ def magic_parser(args):
else:
break
# reset sys.argv since we are now done with it
sys.argv = []
# if -h, -a, or -v found in options, then bail out
if 'h' in options or 'a' in options or 'v' in options:
return False, None, None, []
@ -510,10 +507,11 @@ def main():
options = []
options.extend(magic_options)
# note that sys.argv will be an empty list after magic_parser finds the magic syntax is used
for opt in sys.argv:
if opt.startswith('-') and not opt.startswith('--'):
options.extend(opt[1:])
# only find options if magic_parser did not find a command
if not valid_command:
for opt in sys.argv:
if opt.startswith('-') and not opt.startswith('--'):
options.extend(opt[1:])
about = 'a' in options
debug = 'd' in options