# HG changeset patch # User Shrikant-Sharat # Date 1314896373 -19800 # Node ID 65b004631139c07343611a2cbbaaceae8f0caabc # Parent 2f7fcbc59b021cbcea2205977d5091a32e757796 Allow comments in tasks files diff -r 2f7fcbc59b02 -r 65b004631139 t.py --- 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. diff -r 2f7fcbc59b02 -r 65b004631139 tests/manual.t --- 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.