Add ability to create inputs out directory
parent
46725370c1
commit
4eb63d40b0
16
download.py
16
download.py
|
@ -195,6 +195,10 @@ def wait_for_next_puzzle():
|
||||||
spinner.ok("🎄 ")
|
spinner.ok("🎄 ")
|
||||||
|
|
||||||
|
|
||||||
|
def ensure_dir(path: pathlib.Path):
|
||||||
|
os.makedirs(path)
|
||||||
|
|
||||||
|
|
||||||
def setup_logs(verbose: bool):
|
def setup_logs(verbose: bool):
|
||||||
coloredlogs.install(
|
coloredlogs.install(
|
||||||
level=logging.DEBUG if verbose else logging.INFO,
|
level=logging.DEBUG if verbose else logging.INFO,
|
||||||
|
@ -224,6 +228,13 @@ class FetchCommand(click.Command):
|
||||||
help="The output location of the puzzle inputs",
|
help="The output location of the puzzle inputs",
|
||||||
default=".",
|
default=".",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"-O",
|
||||||
|
"output_dir_make",
|
||||||
|
type=pathlib.Path,
|
||||||
|
help="The output location of the puzzle inputs. Unlike -o, this will create the directory for you",
|
||||||
|
default=None,
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--token-file",
|
"--token-file",
|
||||||
"token_path",
|
"token_path",
|
||||||
|
@ -251,6 +262,7 @@ def main(
|
||||||
passed_token: str,
|
passed_token: str,
|
||||||
token_path: pathlib.Path,
|
token_path: pathlib.Path,
|
||||||
output_dir: pathlib.Path,
|
output_dir: pathlib.Path,
|
||||||
|
output_dir_make: Optional[pathlib.Path],
|
||||||
wait: bool,
|
wait: bool,
|
||||||
input_only: bool,
|
input_only: bool,
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
|
@ -274,6 +286,10 @@ def main(
|
||||||
if wait:
|
if wait:
|
||||||
wait_for_next_puzzle()
|
wait_for_next_puzzle()
|
||||||
|
|
||||||
|
if output_dir_make:
|
||||||
|
ensure_dir(output_dir_make)
|
||||||
|
output_dir = output_dir_make
|
||||||
|
|
||||||
specified_date = PuzzleDate(year=year, day=day) if day and year else None
|
specified_date = PuzzleDate(year=year, day=day) if day and year else None
|
||||||
date_to_fetch = specified_date or PuzzleDate.get_latest()
|
date_to_fetch = specified_date or PuzzleDate.get_latest()
|
||||||
step = None
|
step = None
|
||||||
|
|
Loading…
Reference in New Issue