diff options
Diffstat (limited to 'bin/kanbanscripts/alltasks.py')
-rwxr-xr-x | bin/kanbanscripts/alltasks.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/bin/kanbanscripts/alltasks.py b/bin/kanbanscripts/alltasks.py new file mode 100755 index 0000000..197c4ba --- /dev/null +++ b/bin/kanbanscripts/alltasks.py @@ -0,0 +1,62 @@ +#!/usr/bin/python +import os +from os.path import abspath, dirname +from operator import itemgetter + + +class bcolors: + HEADER = '\033[95m' + OKBLUE = '\033[94m' + OKGREEN = '\033[92m' + WARNING = '\033[93m' + FAIL = '\033[91m' + ENDC = '\033[0m' + + +# assuming that this script is in ~/bin/kanban this will work: +BASE_DIR = abspath(dirname(dirname(dirname(__file__)))) + '/' +project_list = [] +waiting_list = [] +for root, dirnames, filenames in os.walk('%sgtd' % (BASE_DIR)): + for f in filenames: + waiting = False + inprogress = False + if not f.startswith('@') and not f.startswith('.') and not f.startswith('Notes & Settings') and not f.startswith('projx') and not f.startswith("errands"): + + task = f.split("-")[0].strip() + name = f.split("-")[1].strip() + if len(task) > 3: + inprogress = True + with open('%sgtd/%s' % (BASE_DIR, f), "r") as fl: + for line in fl: + for part in line.split(): + if "@waiting" in part: + waiting = True + project_list.append({ + "file": f, + "name": name, + "task": task, + "inprogress": inprogress, + "waiting": waiting, + }) + break + +newlist = sorted(project_list, key=itemgetter('name', 'task')) + +# projects_file = open("/Users/sng/gtd/@projects.txt", 'w') +l_name = '' +for i, p in enumerate(newlist): + if not p['inprogress'] and not p['waiting']: + if l_name == p['name']: + print(p['file'][:-4]) + else: + print(p['file'][:-4]) + l_name = p['name'] + +""" +for i, p in enumerate(newlist): + if i == 0: + print(bcolors.WARNING + "\n------ TASKS WAITING -----" + bcolors.ENDC) + if p['waiting'] is True: + print(p['file'][:-4]) +""" |