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:
12
jc/cli.py
12
jc/cli.py
@ -430,9 +430,6 @@ def magic_parser(args):
|
|||||||
else:
|
else:
|
||||||
break
|
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, -a, or -v found in options, then bail out
|
||||||
if 'h' in options or 'a' in options or 'v' in options:
|
if 'h' in options or 'a' in options or 'v' in options:
|
||||||
return False, None, None, []
|
return False, None, None, []
|
||||||
@ -510,10 +507,11 @@ def main():
|
|||||||
options = []
|
options = []
|
||||||
options.extend(magic_options)
|
options.extend(magic_options)
|
||||||
|
|
||||||
# note that sys.argv will be an empty list after magic_parser finds the magic syntax is used
|
# only find options if magic_parser did not find a command
|
||||||
for opt in sys.argv:
|
if not valid_command:
|
||||||
if opt.startswith('-') and not opt.startswith('--'):
|
for opt in sys.argv:
|
||||||
options.extend(opt[1:])
|
if opt.startswith('-') and not opt.startswith('--'):
|
||||||
|
options.extend(opt[1:])
|
||||||
|
|
||||||
about = 'a' in options
|
about = 'a' in options
|
||||||
debug = 'd' in options
|
debug = 'd' in options
|
||||||
|
Reference in New Issue
Block a user