in pywb/optionparser.py [0:0]
def parse(options, enhance_options):
""" Parse all options and delegate them to those enhance parsers
Arguments:
- options: a list, the command arguments of pywb
- enhance_options: a dict that key is option and
the value is option parser of processing arguments
"""
acceptable_wb_options = "n:c:t:s:b:T:p:u:v:lrkVhwiIx:"\
"y:z:C:H:P:A:g:X:de:SqB:m:Z:f:"\
"Y:a:o:F:j:J:O:R:D:U:Y:W:E:G:Q:"\
"K012:3456789"
# Anonymous_options are those options without prefix dash.
# They were not defined at acceptable_wb_option.
# e.g. destination hostname
anonymous_options = []
# Defined_options are those options begin with dash.
# They were defined at acceptable_wb_option.
# e.g. -c, -t...
defined_options = []
i = 0
while i < len(options):
option = options[i]
i += 1
if option in enhance_options: # enhance options
i += enhance_options[option].load(options[i:])
continue
if not option.startswith("-"): # single option
anonymous_options.append(option)
continue
position = acceptable_wb_options.find(option[1])
if len(option) != 2 or position == -1: # invalid option
raise ValueError("unsupported argument [" + option + "]")
if position < len(acceptable_wb_options)\
and acceptable_wb_options[position + 1] == ":":
# double option
defined_options.append(option)
if i >= len(options):
raise ValueError("option [" + option + "] need an argument")
option = options[i]
i += 1
defined_options.append(option)
continue
else: # single option
defined_options.insert(0, option)
continue
# combine all options
options = [pywbutil.get_wb_path()]
for _, trigger in enhance_options.items():
options += trigger.dump()
options += defined_options
options += anonymous_options
return options