-
Notifications
You must be signed in to change notification settings - Fork 0
/
timeClock.py
49 lines (39 loc) · 1.59 KB
/
timeClock.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
# timeClock.py
# CLI for a time manager application
import sqlite3
import sql_backend
sqlite_file = 'data/timeClock.sqlite'
def main():
while True:
response = input("Enter a CMD or type HELP for more info: ")
if response == "HELP":
print("Enter START to start a new project.")
print("Enter CONT to continue an existing project.")
print("Enter STOP to stop working on a project.")
print("Enter QUIT to exit program.")
elif response == "START":
name = input("Enter a project name: ")
conn = sql_backend.connectToDB(sqlite_file)
sql_backend.create_project_table(conn, name)
sql_backend.add_new_time_instance(conn, name)
sql_backend.closeDB(conn)
print("Now tracking " + name)
elif response == "CONT":
existingName = input("What was the project's name? : ")
conn = sql_backend.connectToDB(sqlite_file)
sql_backend.add_new_time_instance(conn, existingName)
sql_backend.closeDB(conn)
print("Continuing to track " + existingName)
elif response == "STOP":
stopName = input("What was the project's name?: ")
conn = sql_backend.connectToDB(sqlite_file)
sql_backend.add_time_out(conn, stopName)
sql_backend.closeDB(conn)
print("No longer tracking " + stopName)
elif response == "QUIT":
print("Goodbye!")
break
else:
print("Sorry, I don't know what you said!")
if __name__ == '__main__':
main()