applications.py 文件源码

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

项目:flactory 作者: mehdy 项目源码 文件源码
def check_name(ctx, param, value):
    """
        Checks the project name to be a valid name
    :param ctx: app context
    :param param: parameter
    :param value: the parameter value
    :return:
    """
    regex = re.compile(r'^[a-zA-Z_]*')
    if regex.match(value):
        return value
    while True:
        try:
            click.echo(
                click.style("{}".format(value), bold=True) +
                ' is not a valid python package name. try something else',
                err=True)
            value = param.prompt_for_value(ctx)
            if regex.match(value):
                return value
            continue
        except (KeyboardInterrupt, EOFError):
            raise ctx.Abort()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号