-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
72 lines (62 loc) · 2.23 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import sys
import os
import logging
from cli_commands import cli_cmds
from cli_colors import cli_colors
TDS = cli_cmds()
CLIC = cli_colors()
def main() -> None:
os.system('mode con: cols=80 lines=15')
program_status = True
CLIC.clear()
TDS.header()
while program_status:
try:
print(
f'{CLIC.CLR}Waiting for command... (Use "help" to see available commands.)')
command_line = input('>').split()
command = command_line[0]
TDS.header()
match command:
case 'exit':
print(f'{CLIC.OKG}Exiting program with flag 0.{CLIC.CLR}')
program_status = False
case 'time':
TDS.print_time()
case 'help':
TDS.help()
case 'add':
TDS.add_activity()
case 'pom':
if(len(command_line) > 3):
try:
TDS.pomodoro(command_line[1], int(
command_line[2]), int(command_line[3]))
except TypeError:
print(
f'{CLIC.FAIL}ERROR: Invalid arguments{CLIC.CLR}')
except:
logging.exception(
f'{CLIC.FAIL}ERROR: Oops! Something went wrong...{CLIC.CLR}')
else:
TDS.pomodoro()
case 'del':
TDS.delete_activity()
case 'list':
if(len(command_line) > 1):
try:
TDS.list_activities(command_line[1])
except:
logging.exception(
f'{CLIC.FAIL}ERROR: Oops! Something went wrong...{CLIC.CLR}')
else:
TDS.list_activities()
case 'wipe':
TDS.wipe()
case _:
TDS.unknown_command()
except KeyboardInterrupt:
TDS.keyboard_interrupt()
sys.exit()
if __name__ == "__main__":
main()