def output_option_parser(option, opt, value, parser):
"""Parse the string of outputs and validate it.
Args:
option (optparse.Option): the Option instnace.
opt (str): option calling format.
value (str): user input for the option.
parser (optparse.OptionParser): the parser of the option.
Raises:
optparse.OptionValueError. unsupported handler requested.
"""
output_options = get_result_handler_options()
handlers = value.split(',')
for handler in handlers:
if handler not in output_options:
raise optparse.OptionValueError(
'Unsupported handler %r, supported handlers: %s' %
(handler, ", ".join(output_options)))
setattr(parser.values, option.dest, handlers)
评论列表
文章目录