cli.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:rivalcfg 作者: flozz 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号