python类version_option()的实例源码

version_option.py 文件源码 项目:globus-cli 作者: globus 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def version_option(f):
    """
    Largely a custom clone of click.version_option -- almost identical, but
    prints our special output.
    """
    def callback(ctx, param, value):
        # copied from click.decorators.version_option
        # no idea what resilient_parsing means, but...
        if not value or ctx.resilient_parsing:
            return

        print_version()
        ctx.exit(0)

    return click.option('--version', is_flag=True, expose_value=False,
                        is_eager=True, callback=callback, cls=HiddenOption)(f)


问题


面经


文章

微信
公众号

扫码关注公众号