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()
评论列表
文章目录