opts parsing bugfix

This commit is contained in:
The MMGen Project 2024-10-08 13:21:16 +00:00
commit 212cb2d0fb
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 3 additions and 3 deletions

View file

@ -1 +1 @@
15.1.dev2
15.1.dev3

View file

@ -49,7 +49,7 @@ def process_uopts(opts_data, opts):
if len(arg) == 2:
uargs = sys.argv[idx+1:]
return
opt, parm = arg[2:].split('=') if '=' in arg else (arg[2:], None)
opt, parm = arg[2:].split('=', 1) if '=' in arg else (arg[2:], None)
if len(opt) < 2:
die('CmdlineOptError', f'--{opt}: option name must be at least two characters long')
if opt in opts or (opt := get_opt_by_substring(opt, opts)):
@ -66,7 +66,7 @@ def process_uopts(opts_data, opts):
die('CmdlineOptError', f'option --{opt} requires no parameter')
yield (opts[opt].name, True)
else:
opt, parm = arg[2:].split('=') if '=' in arg else (arg[2:], None)
opt, parm = arg[2:].split('=', 1) if '=' in arg else (arg[2:], None)
die('CmdlineOptError', f'--{opt}: unrecognized option')
elif arg[0] == '-' and len(arg) > 1:
for j, sopt in enumerate(arg[1:]):