Skip to content

Commit

Permalink
[pt] search by year
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Dec 15, 2022
1 parent fa6d246 commit ea342f1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions patch_tuesday.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def get_patch_tuesday_data_soup(month: datetime.date) -> bs4.BeautifulSoup:
parser.add_argument("-m", "--months", help="Specify the Patch Tuesday month(s) (can be repeated)",
default=[], action='append',
type=lambda x: datetime.datetime.strptime(x, "%Y-%b"), metavar="YYYY-ABBREVMONTH")
parser.add_argument("-y", "--years", help="Specify a year - will be expended in months (can be repeated)",
default=[], action='append', type=int)
parser.add_argument("--list-products", help="List all products", action="store_true")
parser.add_argument("--brief", help="Display a summary", action="store_true")
parser.add_argument("-v", "--verbose", action="count", dest="verbose",
Expand All @@ -192,6 +194,11 @@ def get_patch_tuesday_data_soup(month: datetime.date) -> bs4.BeautifulSoup:
print(f"Using default product as '{DEFAULT_PRODUCT}'")
args.products = (DEFAULT_PRODUCT,)

if args.years:
for year in args.years:
for i in range(12):
args.months.append(datetime.date(year, 1 + i, 1))

if not len(args.months):
print(f"Using default month as '{datetime.date.today().strftime('%B %Y')}'")
args.months = (datetime.date.today(),)
Expand Down

0 comments on commit ea342f1

Please sign in to comment.