Commit c92f582e authored by jsbell@chromium.org's avatar jsbell@chromium.org

Add more formatting options for my_activity.py

Support --output-format-heading for the headings
('Issues:', etc), and a simple --markdown flag that sets
item and heading formats to something markdown friendly.

R=deymo@chromium.org, szager@chromium.org, deymo

Review URL: https://codereview.chromium.org/116873002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@243204 0039d316-1c4b-4281-b951-d872f2087c98
parent 87884cc0
......@@ -797,6 +797,10 @@ class MyActivity(object):
print "No %s in committers.py, skipping WebKit checks." % email
self.webkit_repo = None
def print_heading(self, heading):
print
print self.options.output_format_heading.format(heading=heading)
def print_change(self, change):
optional_values = {
'reviewers': ', '.join(change['reviewers'])
......@@ -894,7 +898,7 @@ class MyActivity(object):
def print_changes(self):
if self.changes:
print '\nChanges:'
self.print_heading('Changes')
for change in self.changes:
self.print_change(change)
......@@ -912,7 +916,7 @@ class MyActivity(object):
def print_reviews(self):
if self.reviews:
print '\nReviews:'
self.print_heading('Reviews')
for review in self.reviews:
self.print_review(review)
......@@ -925,7 +929,7 @@ class MyActivity(object):
def print_issues(self):
if self.issues:
print '\nIssues:'
self.print_heading('Issues')
for issue in self.issues:
self.print_issue(issue)
......@@ -1031,6 +1035,14 @@ def main():
'--output-format-reviews', metavar='<format>',
default=None,
help='Specifies the format to use when printing reviews.')
output_format_group.add_option(
'--output-format-heading', metavar='<format>',
default=u'{heading}:',
help='Specifies the format to use when printing headings.')
output_format_group.add_option(
'-m', '--markdown', action='store_true',
help='Use markdown-friendly output (overrides --output-format '
'and --output-format-heading)')
parser.add_option_group(output_format_group)
# Remove description formatting
......@@ -1063,6 +1075,10 @@ def main():
end = datetime.today()
options.begin, options.end = begin, end
if options.markdown:
options.output_format = ' * [{title}]({url})'
options.output_format_heading = '### {heading} ###'
print 'Searching for activity by %s' % options.user
print 'Using range %s to %s' % (options.begin, options.end)
......
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