diff --git a/start_day.py b/start_day.py index aa8d394..9dfac6e 100644 --- a/start_day.py +++ b/start_day.py @@ -29,11 +29,6 @@ if exists(day_file): print(day_file, "already exists. Use that one!") exit() -with open("skel_day.py", "r") as IN: - with open(day_file, "w") as OUT: - while in_line := IN.readline(): - OUT.write(in_line.replace("%YEAR%", str(YEAR)).replace("%DAY%", str(DAY))) - start = datetime(YEAR, 12, DAY, 6, 0, 0) now = datetime.now() if start > now: @@ -43,9 +38,14 @@ if start > now: exit() for x in range(time_wait.seconds, -1, -1): - print("Day starts in %02ds.\r") + print("Day starts in %02ds.\r" % x) sleep(1) -call([CHARMS[system()], day_file]) -webbrowser.open("https://adventofcode.com/%d/day/%d" % (YEAR, DAY)) +with open("skel_day.py", "r") as IN: + with open(day_file, "w") as OUT: + while in_line := IN.readline(): + OUT.write(in_line.replace("%YEAR%", str(YEAR)).replace("%DAY%", str(DAY))) + call(["git", "add", day_file]) +webbrowser.open("https://adventofcode.com/%d/day/%d" % (YEAR, DAY)) +call([CHARMS[system()], day_file])