mirror of
https://github.com/thib8956/advent-of-code.git
synced 2026-11-27 00:46:34 +00:00
update aoc helper
This commit is contained in:
1 parent
268b102325
commit
4cdea76660
2 files changed
+14
-10
No files matched your search
+3
-5
@@ -1,6 +1,6 @@
|
||||
import argparse
|
||||
|
||||
from adventofcode.helper import init, run, run_all
|
||||
from adventofcode.helper import init, run, run_all, validate_year
|
||||
|
||||
|
||||
def year_or_all(value):
|
||||
@@ -9,12 +9,10 @@ def year_or_all(value):
|
||||
return value
|
||||
try:
|
||||
year = int(value)
|
||||
if 2015 <= year <= 2025:
|
||||
if (err := validate_year(year)) is None:
|
||||
return year
|
||||
else:
|
||||
raise argparse.ArgumentTypeError(
|
||||
f"Year must be between 2015 and 2025. Got: {year}"
|
||||
)
|
||||
raise argparse.ArgumentTypeError(err)
|
||||
except ValueError:
|
||||
raise argparse.ArgumentTypeError(
|
||||
f"Invalid value: {value}. Must be an integer or 'all'."
|
||||
|
||||
Reference in new issue
Block a user