spec.py 文件源码

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

项目:endpointer 作者: devjack 项目源码 文件源码
def spec_command(ctx, spec_file):
    """
    Describes the specification provided.
    """
    if ctx.obj.debug:
        click.secho(
            "Specification: " + click.format_filename(spec_file),
            fg="yellow"
        )
    spec = Specification(spec_file)
    # This is britle as it assumes info fields are defined in the spec.
    if 'info' in spec:
        version = spec['info']['version']
        title = spec['info']['title']
        spec_license = spec['info']['license']['name'] or 'Unknown'

        banner = f"{title} - v{version}.    {spec_license} licensed"
        click.secho(banner, fg='green')
    else:
        click.secho(f"No info was found in {spec}.", fg="red")

    # TODO: Implement linting of a spec.

    # TODO: implement validation of a spec
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号