-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunDay.py
34 lines (23 loc) · 805 Bytes
/
runDay.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
from os import system, path
from sys import argv
def main():
try:
from termcolor import colored
except ModuleNotFoundError:
print("termcolor required - 'pip install termcolor' and then run again")
return
if len(argv) != 4:
print("Invalid number of arguments.")
print(" Usage: ./runDay <year: int> <day: int> <part: int>")
exit()
year = argv[1]
day = argv[2]
part = argv[3]
command = f"python3 \"{path.dirname(__file__)}/{year}/day{day.zfill(2)}/part{part}.py\""
print(colored(f"Launching Advent of Code {year} - Day {day} Part {part}", 'green'))
print(f"{colored('Executing', 'red')} {colored(command, 'grey')}")
print('')
system(command)
if __name__ == "__main__":
main()