Index: 0.2.2/yagtd-0.2.2/src/yagtd.py =================================================================== --- 0.2.2.orig/yagtd-0.2.2/src/yagtd.py +++ 0.2.2/yagtd-0.2.2/src/yagtd.py @@ -467,6 +467,36 @@ class GTD(cmd.Cmd): do_done = do_close + def do_contexts(self, line): + """Display contexts and next task for each context + GTD> contexts""" + + for context, tasks in self.todo.order('context').items(): + percent = 0 # compute project's percent complete + count = 0 + next = None + for t in tasks: + if t['complete']: + percent += int(t['complete']) + else: + count += 1 + if t['status'] and not t['complete'] and 'next' in t['status']: + next = t + + percent /= len(tasks) + if percent == 100: continue + + # Section title + print self._colorize(CONTEXT_CHAR + context) + ':', + print "%d" % count, + if next: + projects = next['project'] + if projects: + print self._colorize(PROJECT_CHAR + projects[0]), + print self._colorize(" !next: %s" % next['title']) + else: + print + def do_replace(self, id_line): """Replace the entire task by a new one: GTD> replace #id My new task. @computer p:Project"""