Commit 86544541 authored by Gustavo Padovan's avatar Gustavo Padovan
Browse files

contribution-stats: add email argument option

parent 7a18753b
......@@ -61,10 +61,13 @@ def order_results(results, args):
return sorted(results.items(), key=lambda item: contributors[item[0]])
def print_commits(f, results, summary):
def print_commits(f, results, args):
for email, data in results:
f.write("%s <%s> (%d):\n" % (contributors[email], email, data[0]))
if not summary:
f.write("%s" % (contributors[email]))
f.write(" <%s>" % (email))
f.write(" (%d):\n" % (data[0]))
if not args.summary:
for c in data[1]:
f.write("\t%s %s\n" % (c[0][0:9], c[1]))
......@@ -74,7 +77,7 @@ def print_all(results, args):
for r in results:
print_commits(f, r[1], args.summary)
print_commits(f, r[1], args)
if f is not sys.stdout:
......@@ -84,7 +87,7 @@ def generate_html(results, args):
env = jinja2.Environment(loader=jinja2.FileSystemLoader('{}/templates'.format(sys.path[0])))
template = env.get_template('contribution-stats.html.j2')
content = template.render(results=results, contributors=contributors, summary=args.summary)
content = template.render(results=results, contributors=contributors, args=args)
with open(args.html, 'w') as html_file:
......@@ -95,6 +98,8 @@ if __name__ == "__main__":
help="sort output according to the number of commits instead of alphabetic order")
parser.add_argument('-n', '--numbered', action='store_true',
help="suppress commit description and provide a commit count summary only")
parser.add_argument('-e', '--email', action='store_true',
help="show the email address of each contributor")
parser.add_argument('-o', '--output', metavar="FILE",
help="output to a file instead of stdout")
parser.add_argument('--html', metavar="FILE",
{% for r in results %}
<h4>{{ r[0] }}</h4>
{% for email, data in r[1] %}
<strong>{{ contributors[email] }} {{ email }} ({{ data[0]}}):</strong><br />
{% if not summary %}
<strong>{{ contributors[email] }}{% if %} &lt;{{ email }}&gt;{% endif %} ({{ data[0]}}):</strong><br />
{% if not args.summary %}
{% for commit in data[1] %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment