diff options
Diffstat (limited to 'bin/kanbanscripts')
-rwxr-xr-x | bin/kanbanscripts/addtask.sh | 2 | ||||
-rwxr-xr-x | bin/kanbanscripts/alltasks.py | 62 | ||||
-rwxr-xr-x | bin/kanbanscripts/alltasks_by_type.py | 56 | ||||
-rwxr-xr-x | bin/kanbanscripts/havedone.sh | 11 | ||||
-rwxr-xr-x | bin/kanbanscripts/havedonegit.sh | 10 | ||||
-rwxr-xr-x | bin/kanbanscripts/review.py | 51 | ||||
-rwxr-xr-x | bin/kanbanscripts/showall.sh | 4 | ||||
-rwxr-xr-x | bin/kanbanscripts/showalltype.sh | 11 | ||||
-rwxr-xr-x | bin/kanbanscripts/showdone.sh | 4 | ||||
-rwxr-xr-x | bin/kanbanscripts/showinprogress.sh | 3 | ||||
-rwxr-xr-x | bin/kanbanscripts/workon.sh | 2 |
11 files changed, 216 insertions, 0 deletions
diff --git a/bin/kanbanscripts/addtask.sh b/bin/kanbanscripts/addtask.sh new file mode 100755 index 0000000..6099772 --- /dev/null +++ b/bin/kanbanscripts/addtask.sh @@ -0,0 +1,2 @@ +#! /bin/sh +touch ~/gtd/"${2:-FLW} - $1".txt 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]) +""" diff --git a/bin/kanbanscripts/alltasks_by_type.py b/bin/kanbanscripts/alltasks_by_type.py new file mode 100755 index 0000000..e2affd8 --- /dev/null +++ b/bin/kanbanscripts/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'] diff --git a/bin/kanbanscripts/havedone.sh b/bin/kanbanscripts/havedone.sh new file mode 100755 index 0000000..fb47287 --- /dev/null +++ b/bin/kanbanscripts/havedone.sh @@ -0,0 +1,11 @@ +#!/bin/sh +cd ~/gtd +mkdir -p ~/gtd/done/$(date '+%Y-%m-%d') +OIFS="$IFS" +IFS=$'\n' +for f in $(find . -maxdepth 1 -type f -print0 | xargs -0 grep -li @done) + do + printf $f + mv $f ~/gtd/done/$(date '+%Y-%m-%d') + done +IFS="$OIFS" diff --git a/bin/kanbanscripts/havedonegit.sh b/bin/kanbanscripts/havedonegit.sh new file mode 100755 index 0000000..59cb066 --- /dev/null +++ b/bin/kanbanscripts/havedonegit.sh @@ -0,0 +1,10 @@ +OIFS="$IFS" +IFS=$'\n' +for f in $(git log --branches --pretty=format:"%s" --since="5am") + do + #watch out for / in commit messages + nf=${f//\//:} + echo $nf + touch ~/gtd/done/$(date '+%Y-%m-%d')/"$nf".txt + done +IFS="$OIFS" diff --git a/bin/kanbanscripts/review.py b/bin/kanbanscripts/review.py new file mode 100755 index 0000000..a17cccc --- /dev/null +++ b/bin/kanbanscripts/review.py @@ -0,0 +1,51 @@ +#!/usr/bin/python +import os +from os.path import abspath, dirname +from operator import itemgetter + +""" + parse my gtd folder + pull out files that start with the project name which is in [] + loop through and grab the project and then all the associated + tasks (rest of the file name) + print the results out to a file called @project.txt +""" +# assuming that this script is in ~/bin this will work: +BASE_DIR = abspath(dirname(dirname(__file__))) + '/' +project_list = [] +inprogress = False +for root, dirnames, filenames in os.walk('%sgtd' % (BASE_DIR)): + for f in filenames: + 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] + + if f.find("]") > 5: + inprogress = True + task = "* " + task + with open('%sgtd/%s' % (BASE_DIR, f), "r") as fl: + for line in fl: + for part in line.split(): + if "@waiting" in part: + task = task + " -- " + line.rstrip() + project_list.append({ + "file": f, + "name": name, + "task": task, + "inprogress": inprogress, + }) + break + +newlist = sorted(project_list, key=itemgetter('name', 'task')) + +projects_file = open("/Users/sng/gtd/@projects.txt", 'w') +l_name = '' + +for p in newlist: + if l_name == p['name']: + print >> projects_file, "\t" + p['task'] + else: + print >> projects_file, "\n" + p['name'] + print >> projects_file, "\t" + p['task'] + l_name = p['name'] diff --git a/bin/kanbanscripts/showall.sh b/bin/kanbanscripts/showall.sh new file mode 100755 index 0000000..968e6ce --- /dev/null +++ b/bin/kanbanscripts/showall.sh @@ -0,0 +1,4 @@ +clear +echo '---- ALL TASKS -----' +python ~/bin/kanbanscripts/alltasks.py +echo '----' diff --git a/bin/kanbanscripts/showalltype.sh b/bin/kanbanscripts/showalltype.sh new file mode 100755 index 0000000..149fc5c --- /dev/null +++ b/bin/kanbanscripts/showalltype.sh @@ -0,0 +1,11 @@ +GREEN=$(tput setaf 2; tput bold) +NORMAL=$(tput sgr0) +function green() { + echo "$GREEN$*$NORMAL" +} + +clear +echo '---- TODO -----' +python ~/bin/alltasks_by_type.py $1 +echo '.' +echo '.' diff --git a/bin/kanbanscripts/showdone.sh b/bin/kanbanscripts/showdone.sh new file mode 100755 index 0000000..7e3d621 --- /dev/null +++ b/bin/kanbanscripts/showdone.sh @@ -0,0 +1,4 @@ +clear +echo '----- TASKS COMPLETED TODAY -----' +cd ~/gtd/done/$(date '+%Y-%m-%d') +ls | grep '' diff --git a/bin/kanbanscripts/showinprogress.sh b/bin/kanbanscripts/showinprogress.sh new file mode 100755 index 0000000..9b446dc --- /dev/null +++ b/bin/kanbanscripts/showinprogress.sh @@ -0,0 +1,3 @@ +clear +echo '----- TASKS IN PROGRESS -----' +cd ~/gtd && ls | grep ^qq | cut -c 4- | cut -f 1 -d '.' diff --git a/bin/kanbanscripts/workon.sh b/bin/kanbanscripts/workon.sh new file mode 100755 index 0000000..90a6e1f --- /dev/null +++ b/bin/kanbanscripts/workon.sh @@ -0,0 +1,2 @@ +#! /bin/sh +mv {,qq\ }"$1" |