44d920ae117e

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 20 Sep 2011 18:52:15 -0400
parents 2e3102258623 (current diff) 65b004631139 (diff)
children 6311beda0836
branches/tags (none)
files t.py

Changes

--- a/t.py	Tue Sep 20 18:47:55 2011 -0400
+++ b/t.py	Tue Sep 20 18:52:15 2011 -0400
@@ -51,7 +51,9 @@
     and other metadata will be generated when the line is read.  This is
     supported to enable editing of the taskfile with a simple text editor.
     """
-    if '|' in taskline:
+    if taskline.strip().startswith('#'):
+        return None
+    elif '|' in taskline:
         text, _, meta = taskline.rpartition('|')
         task = { 'text': text.strip() }
         for piece in meta.strip().split(','):
@@ -136,7 +138,8 @@
                     tls = [tl.strip() for tl in tfile if tl]
                     tasks = map(_task_from_taskline, tls)
                     for task in tasks:
-                        getattr(self, kind)[task['id']] = task
+                        if task is not None:
+                            getattr(self, kind)[task['id']] = task
 
     def __getitem__(self, prefix):
         """Return the unfinished task with the given prefix.
--- a/tests/manual.t	Tue Sep 20 18:47:55 2011 -0400
+++ b/tests/manual.t	Tue Sep 20 18:52:15 2011 -0400
@@ -30,3 +30,8 @@
   $ xt
   5 - New.
 
+Add comments to task file:
+
+  $ echo '# this is a comment' >> test
+  $ xt
+  5 - New.