Add ability to just download input

master
Nick Krichevsky 2022-12-11 23:39:47 -05:00
parent 2858395e48
commit 5cdbf60745
1 changed files with 5 additions and 2 deletions

View File

@ -198,6 +198,7 @@ class FetchCommand(click.Command):
help="The location of the advent of code session token. Ignored if --token is provided.",
)
@click.option("--wait", is_flag=True, help="Wait until new puzzle inputs are ready")
@click.option("--inputonly", "input_only", is_flag=True, help="Don't attempt to fetch sample inputs")
@click.option("--year", type=int)
@click.option("--day", type=int)
def main(
@ -206,6 +207,7 @@ def main(
token_path: pathlib.Path,
output_dir: pathlib.Path,
wait: bool,
input_only: bool,
day: Optional[int],
year: Optional[int],
):
@ -230,8 +232,9 @@ def main(
date_to_fetch = specified_date or PuzzleDate.get_latest()
step = None
try:
step = "download sample inputs"
download_sample_inputs(date_to_fetch, output_dir)
if not input_only:
step = "download sample inputs"
download_sample_inputs(date_to_fetch, output_dir)
step = "download input"
download_input(date_to_fetch, token, output_dir)
except requests.exceptions.HTTPError as err: