forked from mastergreg/kerneldir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo
executable file
·68 lines (61 loc) · 1.8 KB
/
todo
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
#!/usr/bin/env python
#/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
#
#* File Name : todo.py
#
#* Purpose :
#
#* Creation Date : 06-02-2012
#
#* Last Modified : Mon 06 Feb 2012 05:31:52 PM EET
#
#* Created By : Greg Liras <[email protected]>
#
#_._._._._._._._._._._._._._._._._._._._._.*/
FIXED_STATUS_COLOR="green"
PENDING_STATUS_COLOR="red"
OTHER_STATUS_COLOR="magenta"
ASSIGNEE_COLOR="cyan"
MESSAGE_COLOR="blue"
PRIORITY_COLOR="yellow"
from termcolor import colored
def findTODO(current="TODO", depth=0):
if depth > 15:
raise IOError
try:
f = open(current,"r")
except IOError:
f = findTODO("../"+current, depth+1)
return f
def main():
try:
f = findTODO()
except IOError:
print "No TODO file found, exiting..."
return 0
tasks = map(lambda x : x.strip().split("--"), f.readlines() )
for task in tasks:
if ( task[0].startswith("*") ):
message = task[0]
try:
assignee = task[1].split()[0]
except IndexError:
assignee = "none"
try:
priority = task[2].split()[0]
except IndexError:
priority = "10"
try:
status = task[3].split()[0]
if status == "FIXED":
STATUS_COLOR = FIXED_STATUS_COLOR
else:
STATUS_COLOR = OTHER_STATUS_COLOR
except IndexError:
STATUS_COLOR = PENDING_STATUS_COLOR
status = "PENDING"
print "Message: ", colored( message, MESSAGE_COLOR )
print "Assigned to: ", colored( assignee, ASSIGNEE_COLOR )
print "Status: ", colored( status, STATUS_COLOR ), "[ ", colored( priority, PRIORITY_COLOR ), " ]"
if __name__=="__main__":
main()