7cbbec2d86e1 v1.2.0

Sort tasks by ID in the output.
[view raw] [browse files]
author Steve Losh <steve@dwaiter.com>
date Sun, 03 Oct 2010 18:55:33 -0400
parents 70a8dbc508e2
children 9bb1865858a7
branches/tags v1.2.0
files t.py tests/basic.t tests/collisions.t tests/errors.t tests/manual.t

Changes

--- a/t.py	Sun Oct 03 18:49:02 2010 -0400
+++ b/t.py	Sun Oct 03 18:55:33 2010 -0400
@@ -202,7 +202,7 @@
                 tasks[task_id]['prefix'] = prefix
 
         plen = max(map(lambda t: len(t[label]), tasks.values())) if tasks else 0
-        for task in tasks.values():
+        for _, task in sorted(tasks.items()):
             if grep.lower() in task['text'].lower():
                 p = '%s - ' % task[label].ljust(plen) if not quiet else ''
                 print p + task['text']
--- a/tests/basic.t	Sun Oct 03 18:49:02 2010 -0400
+++ b/tests/basic.t	Sun Oct 03 18:55:33 2010 -0400
@@ -10,8 +10,8 @@
   3 - Sample one.
   $ xt Sample two.
   $ xt
+  3 - Sample one.
   7 - Sample two.
-  3 - Sample one.
 
 Finishing tasks:
 
--- a/tests/collisions.t	Sun Oct 03 18:49:02 2010 -0400
+++ b/tests/collisions.t	Sun Oct 03 18:55:33 2010 -0400
@@ -20,19 +20,19 @@
   $ xt 14
   $ xt
   0  - 9
+  17 - 11
+  1b - 4
   3  - 1
-  1b - 4
+  77 - 3
   7b - 12
-  fe - 8
+  9  - 7
+  a  - 5
+  b1 - 10
   bd - 13
-  77 - 3
   c  - 6
-  9  - 7
-  b1 - 10
-  a  - 5
+  d  - 2
   fa - 14
-  17 - 11
-  d  - 2
+  fe - 8
 
 Even more ambiguity:
 
@@ -51,32 +51,32 @@
   $ xt 13test
   $ xt 14test
   $ xt
+  07  - 8test
   0a  - 9
+  0e  - 9test
+  14  - 6test
+  17  - 11
+  1b  - 4
+  2   - 5test
+  35  - 1
+  36  - 4test
+  5   - 2test
+  6   - 11test
+  77  - 3
+  7b  - 12
+  8   - 12test
+  90  - 7
+  95  - 3test
+  a1  - 7test
+  ac  - 5
+  b10 - 10test
+  b1d - 10
   bd  - 13
+  c1  - 6
+  c7  - 13test
   d   - 2
   ee  - 1test
+  ef  - 14test
+  fa  - 14
   fe  - 8
-  77  - 3
-  2   - 5test
-  14  - 6test
-  35  - 1
-  90  - 7
-  8   - 12test
-  b1d - 10
-  17  - 11
-  a1  - 7test
-  7b  - 12
-  c7  - 13test
-  07  - 8test
-  36  - 4test
-  6   - 11test
-  0e  - 9test
-  b10 - 10test
-  95  - 3test
-  fa  - 14
-  1b  - 4
-  ef  - 14test
-  5   - 2test
-  c1  - 6
-  ac  - 5
 
--- a/tests/errors.t	Sun Oct 03 18:49:02 2010 -0400
+++ b/tests/errors.t	Sun Oct 03 18:55:33 2010 -0400
@@ -14,8 +14,8 @@
   $ xt -e BAD This should not be replaced.
   The ID "BAD" does not match any task.%
   $ xt
+  3 - Sample one.
   7 - Sample two.
-  3 - Sample one.
 
 Ambiguous identifiers:
 
@@ -39,21 +39,21 @@
   The ID "e" does not match any task.%
   $ xt
   0  - 9
-  35 - 1
+  17 - 11
   1b - 4
   32 - Sample one.
-  7a - Sample two.
-  bd - 13
+  35 - 1
   77 - 3
-  c  - 6
+  7a - Sample two.
+  7b - 12
   9  - 7
+  a  - 5
   b1 - 10
-  a  - 5
-  7b - 12
+  bd - 13
+  c  - 6
+  d  - 2
   fa - 14
-  17 - 11
   fe - 8
-  d  - 2
 
 Even more ambiguity:
 
@@ -72,69 +72,69 @@
   $ xt 13test
   $ xt 14test
   $ xt
+  07  - 8test
   0a  - 9
+  0e  - 9test
+  14  - 6test
+  17  - 11
+  1b  - 4
+  2   - 5test
+  32  - Sample one.
+  35  - 1
+  36  - 4test
   5   - 2test
+  6   - 11test
+  77  - 3
+  7a  - Sample two.
+  7b  - 12
+  8   - 12test
+  90  - 7
+  95  - 3test
+  a1  - 7test
+  ac  - 5
+  b10 - 10test
+  b1d - 10
+  bd  - 13
+  c1  - 6
+  c7  - 13test
   d   - 2
   ee  - 1test
+  ef  - 14test
+  fa  - 14
   fe  - 8
-  77  - 3
-  2   - 5test
-  14  - 6test
-  35  - 1
-  32  - Sample one.
-  90  - 7
-  8   - 12test
-  b1d - 10
-  17  - 11
-  a1  - 7test
-  7b  - 12
-  c7  - 13test
-  07  - 8test
-  36  - 4test
-  6   - 11test
-  0e  - 9test
-  b10 - 10test
-  95  - 3test
-  fa  - 14
-  1b  - 4
-  ef  - 14test
-  7a  - Sample two.
-  bd  - 13
-  c1  - 6
-  ac  - 5
   $ xt -f b1
   The ID "b1" matches more than one task.%
   $ xt -e b1
   The ID "b1" matches more than one task.%
   $ xt
+  07  - 8test
   0a  - 9
+  0e  - 9test
+  14  - 6test
+  17  - 11
+  1b  - 4
+  2   - 5test
+  32  - Sample one.
+  35  - 1
+  36  - 4test
   5   - 2test
+  6   - 11test
+  77  - 3
+  7a  - Sample two.
+  7b  - 12
+  8   - 12test
+  90  - 7
+  95  - 3test
+  a1  - 7test
+  ac  - 5
+  b10 - 10test
+  b1d - 10
+  bd  - 13
+  c1  - 6
+  c7  - 13test
   d   - 2
   ee  - 1test
+  ef  - 14test
+  fa  - 14
   fe  - 8
-  77  - 3
-  2   - 5test
-  14  - 6test
-  35  - 1
-  32  - Sample one.
-  90  - 7
-  8   - 12test
-  b1d - 10
-  17  - 11
-  a1  - 7test
-  7b  - 12
-  c7  - 13test
-  07  - 8test
-  36  - 4test
-  6   - 11test
-  0e  - 9test
-  b10 - 10test
-  95  - 3test
-  fa  - 14
-  1b  - 4
-  ef  - 14test
-  7a  - Sample two.
-  bd  - 13
-  c1  - 6
-  ac  - 5
 
--- a/tests/manual.t	Sun Oct 03 18:49:02 2010 -0400
+++ b/tests/manual.t	Sun Oct 03 18:55:33 2010 -0400
@@ -9,17 +9,17 @@
   > Sample two.
   > EOF
   $ xt
+  3 - Sample one.
   7 - Sample two.
-  3 - Sample one.
 
 Add some manual tasks:
 
   $ echo 'Custom one. | id: custom1' >> test
   $ echo 'Custom two. | id: custom2' >> test
   $ xt
+  3       - Sample one.
   7       - Sample two.
   custom1 - Custom one.
-  3       - Sample one.
   custom2 - Custom two.
 
 Rewrite the task file: