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