__main__.py 文件源码

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

项目:crc-diagram 作者: IuryAlves 项目源码 文件源码
def main(source, out, raw, format, view):
    """
    Generate CRCDiagrams from SOURCE saving they as OUT.
    \n
    The default output format is png.
    \n
    Example:\n
    crc-diagram source_file.py output.png
    """
    if os.path.isdir(source):
        crc_cards = crc_diagram.folder_to_crc(source)
    else:
        crc_cards = crc_diagram.to_crc(source)

    if raw:
        out = path_to_stream(out or sys.stdout, 'w')
        json.dump([crc.to_dict() for crc in crc_cards], out, indent=4)
    else:
        if out is None:
            raise click.UsageError('Missing argument "out".')
        DotRender(crc_cards, format=format).render(out, view=view)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号