Fix taskline parsing to allow pipes(|) in task
author |
zack <zack@heavybook.home> |
date |
Thu, 08 Sep 2011 22:46:50 -0400 |
parents |
2f7fcbc59b02
|
children |
2e3102258623
|
branches/tags |
(none) |
files |
t.py tests/basic.t tests/editing.t tests/finished.t |
Changes
--- a/t.py Mon May 09 21:22:15 2011 -0400
+++ b/t.py Thu Sep 08 22:46:50 2011 -0400
@@ -52,7 +52,7 @@
supported to enable editing of the taskfile with a simple text editor.
"""
if '|' in taskline:
- text, _, meta = taskline.partition('|')
+ text, _, meta = taskline.rpartition('|')
task = { 'text': text.strip() }
for piece in meta.strip().split(','):
label, data = piece.split(':')
--- a/tests/basic.t Mon May 09 21:22:15 2011 -0400
+++ b/tests/basic.t Thu Sep 08 22:46:50 2011 -0400
@@ -12,12 +12,21 @@
$ xt
3 - Sample one.
7 - Sample two.
+ $ xt 'this | that'
+ $ xt
+ 3 - Sample one.
+ 4 - this | that
+ 7 - Sample two.
Finishing tasks:
$ xt -f 3
$ xt
+ 4 - this | that
7 - Sample two.
$ xt -f 7
$ xt
+ 4 - this | that
+ $ xt -f 4
+ $ xt
--- a/tests/editing.t Mon May 09 21:22:15 2011 -0400
+++ b/tests/editing.t Thu Sep 08 22:46:50 2011 -0400
@@ -10,10 +10,23 @@
$ xt -e a New sample.
$ xt
a - New sample.
+ $ xt 'this | that'
+ $ xt
+ 4 - this | that
+ a - New sample.
+ $ xt -e 4 'this &| that'
+ $ xt
+ 4 - this &| that
+ a - New sample.
Sed-style substitution:
$ xt -e a 's/New/Testing/'
$ xt
+ 4 - this &| that
+ a - Testing sample.
+ $ xt -e 4 '/this &/this /'
+ $ xt
+ 4 - this | that
a - Testing sample.
--- a/tests/finished.t Mon May 09 21:22:15 2011 -0400
+++ b/tests/finished.t Thu Sep 08 22:46:50 2011 -0400
@@ -8,6 +8,7 @@
$ xt Sample two.
$ xt Sample three.
$ xt Sample four.
+ $ xt 'this | that'
Finish and test .test.done:
@@ -29,4 +30,11 @@
Sample one. | id:329950673481cb1c19102c982bfc63e745ab4a6f
Sample two. | id:7a4dc18c23f3b890602da09da1690ccfb4c87bd1
Sample three. | id:90cf0626ca134e0aa6453b3562dc1c8bb34f1568
+ $ xt -f 4
+ $ cat .test.done
+ Sample four. | id:1dd56b09a9ca0fdf4f2a8c0959a298098eb8f7de
+ Sample one. | id:329950673481cb1c19102c982bfc63e745ab4a6f
+ this | that | id:48ad7c827191fa3c896d13b47f618ff1732e911e
+ Sample two. | id:7a4dc18c23f3b890602da09da1690ccfb4c87bd1
+ Sample three. | id:90cf0626ca134e0aa6453b3562dc1c8bb34f1568