diff options
Diffstat (limited to 'kanbanscripts')
-rwxr-xr-x | kanbanscripts/addtask.py | 48 | ||||
-rwxr-xr-x | kanbanscripts/addtask.sh | 9 | ||||
-rwxr-xr-x | kanbanscripts/alltasks.py | 62 | ||||
-rwxr-xr-x | kanbanscripts/alltasks_by_type.py | 56 | ||||
-rwxr-xr-x | kanbanscripts/havedone.sh | 11 | ||||
-rwxr-xr-x | kanbanscripts/havedonegit.sh | 10 | ||||
-rwxr-xr-x | kanbanscripts/review.py | 51 | ||||
-rwxr-xr-x | kanbanscripts/showall.sh | 4 | ||||
-rwxr-xr-x | kanbanscripts/showalltype.sh | 11 | ||||
-rwxr-xr-x | kanbanscripts/showdone.sh | 4 | ||||
-rwxr-xr-x | kanbanscripts/showinprogress.sh | 3 | ||||
-rw-r--r-- | kanbanscripts/starttask.sh | 9 | ||||
-rwxr-xr-x | kanbanscripts/workon.sh | 2 |
13 files changed, 280 insertions, 0 deletions
diff --git a/kanbanscripts/addtask.py b/kanbanscripts/addtask.py new file mode 100755 index 0000000..59522a2 --- /dev/null +++ b/kanbanscripts/addtask.py @@ -0,0 +1,48 @@ +#!/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' +project_list = [] +waiting_list = [] +with open('~/notes/gtd.txt', "rw") as todo: + waiting = False + inprogress = False + for line in todo: + for part in line.split(): + if "@waiting" in part: + waiting = True + project_list.append({ + "file": f, + "name": name, + "task": task, + "inprogress": inprogress, + "waiting": waiting, + }) + +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: + if i != 0: + print(" ") + 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'] == True: + print(p['file'][:-4]) diff --git a/kanbanscripts/addtask.sh b/kanbanscripts/addtask.sh new file mode 100755 index 0000000..499784b --- /dev/null +++ b/kanbanscripts/addtask.sh @@ -0,0 +1,9 @@ +#! /bin/sh +FILENAME="$HOME/gtd/${2:-WIR} - $1.txt" +echo $FILENAME +touch "$FILENAME" +echo "@recorded:$(date '+%Y-%m-%d')" >> "$FILENAME" +if [ $# -eq 3 ] + then + printf "$3" >> "$FILENAME" +fi diff --git a/kanbanscripts/alltasks.py b/kanbanscripts/alltasks.py new file mode 100755 index 0000000..195f6c6 --- /dev/null +++ b/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('proj') 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/kanbanscripts/alltasks_by_type.py b/kanbanscripts/alltasks_by_type.py new file mode 100755 index 0000000..e2affd8 --- /dev/null +++ b/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/kanbanscripts/havedone.sh b/kanbanscripts/havedone.sh new file mode 100755 index 0000000..fb47287 --- /dev/null +++ b/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/kanbanscripts/havedonegit.sh b/kanbanscripts/havedonegit.sh new file mode 100755 index 0000000..59cb066 --- /dev/null +++ b/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/kanbanscripts/review.py b/kanbanscripts/review.py new file mode 100755 index 0000000..a17cccc --- /dev/null +++ b/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/kanbanscripts/showall.sh b/kanbanscripts/showall.sh new file mode 100755 index 0000000..968e6ce --- /dev/null +++ b/kanbanscripts/showall.sh @@ -0,0 +1,4 @@ +clear +echo '---- ALL TASKS -----' +python ~/bin/kanbanscripts/alltasks.py +echo '----' diff --git a/kanbanscripts/showalltype.sh b/kanbanscripts/showalltype.sh new file mode 100755 index 0000000..149fc5c --- /dev/null +++ b/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/kanbanscripts/showdone.sh b/kanbanscripts/showdone.sh new file mode 100755 index 0000000..7e3d621 --- /dev/null +++ b/kanbanscripts/showdone.sh @@ -0,0 +1,4 @@ +clear +echo '----- TASKS COMPLETED TODAY -----' +cd ~/gtd/done/$(date '+%Y-%m-%d') +ls | grep '' diff --git a/kanbanscripts/showinprogress.sh b/kanbanscripts/showinprogress.sh new file mode 100755 index 0000000..9b446dc --- /dev/null +++ b/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/kanbanscripts/starttask.sh b/kanbanscripts/starttask.sh new file mode 100644 index 0000000..ae13949 --- /dev/null +++ b/kanbanscripts/starttask.sh @@ -0,0 +1,9 @@ +#! /bin/sh +FILENAME="$1" +echo $FILENAME +echo "@started:$(date '+%Y-%m-%d')" >> "$FILENAME" +if [ $# -eq 3 ] + then + printf "$3" >> "$FILENAME" +fi +mv {,qq\ }"$FILENAME" diff --git a/kanbanscripts/workon.sh b/kanbanscripts/workon.sh new file mode 100755 index 0000000..90a6e1f --- /dev/null +++ b/kanbanscripts/workon.sh @@ -0,0 +1,2 @@ +#! /bin/sh +mv {,qq\ }"$1" |