summaryrefslogtreecommitdiff
path: root/alltasks_by_type.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
committerluxagraf <sng@luxagraf.net>2023-06-15 15:58:59 -0500
commitab987e10f154f5536bb8fd936ae0966e909fa969 (patch)
tree9de5076f38b71ececb1bc94f8d9d19170898d603 /alltasks_by_type.py
added all my scriptssynced/master
Diffstat (limited to 'alltasks_by_type.py')
-rwxr-xr-xalltasks_by_type.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/alltasks_by_type.py b/alltasks_by_type.py
new file mode 100755
index 0000000..a0c2746
--- /dev/null
+++ b/alltasks_by_type.py
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+import os
+import sys
+from os.path import abspath, dirname
+from operator import itemgetter
+
+ARG = sys.argv[1]
+
+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 this will work:
+BASE_DIR = abspath(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"):
+ name = f[f.find("[") + 1:f.find("]")]
+ task = f[f.find("]") + 2:-4]
+ 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
+ if name == ARG:
+ 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 i == 0:
+ print(bcolors.WARNING + '------ %s TASKS -----' % ARG + bcolors.ENDC)
+ if not p['inprogress'] and not p['waiting']:
+ if l_name == p['name']:
+ print(p['file'][:-4])
+ else:
+ if i != 0:
+ print(" ")
+ print(p['file'][:-4])
+ l_name = p['name']