Allow comments in tasks files
author |
Shrikant-Sharat <shrikantsharat.k@gmail.com> |
date |
Thu, 01 Sep 2011 22:29:33 +0530 |
parents |
2f7fcbc59b02
|
children |
44d920ae117e
|
branches/tags |
(none) |
files |
t.py tests/manual.t |
Changes
--- a/t.py Mon May 09 21:22:15 2011 -0400
+++ b/t.py Thu Sep 01 22:29:33 2011 +0530
@@ -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.partition('|')
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 Mon May 09 21:22:15 2011 -0400
+++ b/tests/manual.t Thu Sep 01 22:29:33 2011 +0530
@@ -30,3 +30,8 @@
$ xt
5 - New.
+Add comments to task file:
+
+ $ echo '# this is a comment' >> test
+ $ xt
+ 5 - New.