Add --last_week/-W option to my_activity.py
Some weeks, writing snippets on Monday just doesn't happen. And during
those weeks, doing date arithmetic then correctly formatting a U.S.
date is too hard.
R=szager@chromium.org, deymo@chromium.org
Review URL: https://codereview.chromium.org/230823003
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@262723 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/my_activity.py b/my_activity.py
index 48aeaea..a64f3c8 100755
--- a/my_activity.py
+++ b/my_activity.py
@@ -702,7 +702,7 @@
relativedelta(months=2))
parser.add_option(
'-Q', '--last_quarter', action='store_true',
- help='Use last quarter\'s dates, e.g. %s to %s' % (
+ help='Use last quarter\'s dates, i.e. %s to %s' % (
quarter_begin.strftime('%Y-%m-%d'), quarter_end.strftime('%Y-%m-%d')))
parser.add_option(
'-Y', '--this_year', action='store_true',
@@ -711,6 +711,9 @@
'-w', '--week_of', metavar='<date>',
help='Show issues for week of the date')
parser.add_option(
+ '-W', '--last_week', action='store_true',
+ help='Show last week\'s issues')
+ parser.add_option(
'-a', '--auth',
action='store_true',
help='Ask to authenticate for instances with no auth cookie')
@@ -791,6 +794,8 @@
begin, end = get_year_of(datetime.today())
elif options.week_of:
begin, end = (get_week_of(datetime.strptime(options.week_of, '%m/%d/%y')))
+ elif options.last_week:
+ begin, end = (get_week_of(datetime.today() - timedelta(days=7)))
else:
begin, end = (get_week_of(datetime.today() - timedelta(days=1)))
else: