cli.py 文件源码

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

项目:contributors 作者: pydanny 项目源码 文件源码
def main(repo_names, since, until, format, filename):
    """Console script for contributors"""
    # If the filename is not provided, build a default using the format
    if filename is None:
        filename = 'output.{}'.format(format)
    # If the file extension of the filename provided by the user does
    # not match the format provided, warn the user and continue.
    if filename.rsplit('.', 1)[1] != format:
        click.echo('Warning: file extension does not match output format')
    if since is None:
        since = datetime(2012, 6, 2, tzinfo=EST())
    if until is None:
        until = datetime.now(EST())
    output = get_contribitors(repo_names, since=since, until=until, format=format)
    click.echo('\nSaving results to %s' % filename)
    with open(filename, 'w') as f:
        f.write(output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号