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