jwutils.Options: Increase option parsing error verbosity

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2024-01-18 12:22:08 +01:00
commit 9dd957c9d3

View file

@ -3,6 +3,7 @@ import json
from collections import OrderedDict from collections import OrderedDict
from .log import * from .log import *
import shlex import shlex
import traceback
class Options: # export class Options: # export
@ -39,7 +40,12 @@ class Options: # export
if r is not None: if r is not None:
return r return r
r = cls() r = cls()
opt_strs = shlex.split(opts_str) try:
opt_strs = shlex.split(opts_str)
except Exception as e:
slog_m(ERR, traceback.format_exc())
slog(ERR, 'Failed to split options string >{}<'.format(opts_str))
raise
for opt_str in opt_strs: for opt_str in opt_strs:
opt_str = re.sub('\s*=\s*', '=', opt_str) opt_str = re.sub('\s*=\s*', '=', opt_str)
sides = opt_str.split('=') sides = opt_str.split('=')