def _add_mouse_options(parser, profile):
group = OptionGroup(parser, "%s Options" % profile["name"])
command_names = sorted(profile["commands"].keys())
for command_name in command_names:
if command_name == "save":
continue
command = profile["commands"][command_name]
adder_name = "_add_%s_option" % command["value_type"]
if adder_name not in globals():
raise Exception("Unable to create a CLI option for value type '%s'" % command["value_type"]) # noqa
globals()[adder_name](group, command_name, command)
group.add_option(
"-r", "--reset",
help="Reset all options to their factory values",
action="store_true"
)
parser.add_option_group(group)
评论列表
文章目录