todo.rb 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/todo.rb CHANGED
@@ -23,10 +23,15 @@ t = TodoRb.new opts
23
23
  args = ARGV.dup
24
24
 
25
25
  if args.size <= 2 && args.delete('!')
26
-
26
+ # This is kind of a hack!
27
27
  exec "#{File.expand_path(__FILE__)} #{args.join(' ')} | grep '!'"
28
28
  end
29
29
 
30
+ if args[0] =~ /^-\d+$/
31
+ range = args.shift
32
+ exec "#{File.expand_path(__FILE__)} #{args.join(' ')} | head #{range}"
33
+ end
34
+
30
35
  command = args.shift
31
36
  has_args = !args.empty?
32
37
  rest_args = args.join(' ')
@@ -37,11 +42,11 @@ if tag && has_args
37
42
  c = args.join =~ /!/ ? '0i' : 'a'
38
43
  t.ed_command!(c, [TodoRb.expand_tag(tag)] + args)
39
44
  elsif tag
40
- t.filter TodoRb.expand_tag(tag)
45
+ t.filter tag:TodoRb.expand_tag(tag)
41
46
  elsif command == 'done' && args[0] =~ /^(@|\+)/
42
- t.filter_done_file TodoRb.expand_tag(args[0])
47
+ t.filter tag:TodoRb.expand_tag(args[0]), list: :done
43
48
  elsif command == 'done'
44
- t.filter_done_file nil
49
+ t.filter list: :done
45
50
  elsif command == 'all'
46
51
  t.list_all TodoRb.expand_tag(args[0])
47
52
  elsif command == 'do'
@@ -61,7 +66,7 @@ elsif command == 'depri' && args[0]
61
66
  elsif command =~ /e(dit)?$/
62
67
  t.external_edit rest_args
63
68
  elsif command.nil?
64
- t.catn
69
+ t.filter
65
70
  else
66
71
  t.ed_command! command, *args
67
72
  end
data/lib/todo.rb/help.rb CHANGED
@@ -33,6 +33,9 @@ t report show task report
33
33
  t all list all incomplete and done tasks
34
34
  t all [tag] ditto, but filter by tag
35
35
 
36
+ If the first argument is -n, where n is a number, the command is equivalent to
37
+
38
+ t [rest of args] | head -n
36
39
 
37
40
  Tag colors can be customized in colors.yml. It may look something like this.
38
41
 
@@ -1,3 +1,3 @@
1
1
  class TodoRb
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
data/lib/todo.rb.rb CHANGED
@@ -66,33 +66,29 @@ END
66
66
  exec "diff #{backup_file} #{todo_file}"
67
67
  end
68
68
 
69
- def catn(list_file = todo_file)
70
- exec <<END
71
- cat -n #{list_file} | #{formatter}
72
- END
73
- end
69
+ def filter(opts={})
70
+ defaults = {list_file: todo_file, no_exec: false}
71
+ if opts[:list]
72
+ opts[:list_file] = opts[:list] == :todo ? todo_file : done_file
73
+ end
74
+ opts = defaults.merge opts
75
+ tag = opts[:tag]
74
76
 
75
- def filter(context_or_project=nil, list_file=todo_file, no_exec=false)
76
- s = context_or_project
77
- # don't put /< before the grep arg
78
- grep_filter = s ? " | grep -i '#{s}\\>' " : ""
77
+ # note don't put /< before the grep arg
78
+ grep_filter = tag ? " | grep -i '#{tag}\\>' " : ""
79
79
  script = <<END
80
- cat -n #{list_file} #{grep_filter} | #{formatter} #{s ? "'#{s}'" : ''}
80
+ cat -n #{opts[:list_file]} #{grep_filter} | #{formatter} #{tag ? "'#{tag}'" : ''}
81
81
  END
82
- if no_exec
82
+ if opts[:no_exec] # just return for further processing
83
83
  script
84
84
  else
85
85
  exec(script)
86
86
  end
87
87
  end
88
88
 
89
- def filter_done_file(t)
90
- filter t, done_file
91
- end
92
-
93
89
  def list_all tag=nil
94
- a = filter tag, todo_file, true
95
- b = filter tag, done_file, true
90
+ a = filter tag:tag, list_file:todo_file, no_exec:true
91
+ b = filter tag:tag, list_file:done_file, no_exec:true
96
92
  exec ["echo 'todo'", a, "echo 'done'", b].join("\n")
97
93
  end
98
94
 
data/todo.txt CHANGED
@@ -1,2 +1,2 @@
1
- @features TEST sets et maybe remove the t ! filter; not really necessary estset
2
1
  another item
2
+ @features TEST sets et maybe remove the t ! filter; not really necessary estset
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todo.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-31 00:00:00.000000000Z
12
+ date: 2012-02-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
16
- requirement: &70326420042860 !ruby/object:Gem::Requirement
16
+ requirement: &22164760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.6.11
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70326420042860
24
+ version_requirements: *22164760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: color-tools
27
- requirement: &70326420042100 !ruby/object:Gem::Requirement
27
+ requirement: &22162900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '1.3'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70326420042100
35
+ version_requirements: *22162900
36
36
  description: ed-like todo list manager
37
37
  email:
38
38
  - dhchoi@gmail.com
@@ -49,7 +49,6 @@ files:
49
49
  - README.md
50
50
  - Rakefile
51
51
  - bin/todo.rb
52
- - index.html
53
52
  - lib/color_config.rb
54
53
  - lib/colorizer.rb
55
54
  - lib/html.rb
data/index.html DELETED
@@ -1,572 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset='utf-8'>
5
-
6
- <title>danchoi/todo.rb @ GitHub</title>
7
-
8
- <style type="text/css">
9
- body {
10
- margin-top: 1.0em;
11
- background-color: #FFFFFF;
12
- font-family: Helvetica, Arial, FreeSans, san-serif;
13
- color: #555555;
14
- line-height: 1.5em;
15
- }
16
- #container {
17
- margin: 0 auto;
18
- width: 700px;
19
- }
20
- h1 { font-size: 3.8em; color: #333333; margin-bottom: 3px; }
21
- h1 .small { font-size: 0.4em; }
22
- h1 a { text-decoration: none }
23
- h2 { margin-top: 1.5em; font-size: 1.5em; color: #333333; }
24
- h3 { text-align: center; color: #333333; }
25
- a { color: #333333; }
26
- .description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
27
- .download { float: right; }
28
- code {
29
- font-size: 0.9em;
30
- font-family:Andale Mono;
31
- background-color:#ECECEC;
32
- border: 1px solid #DDD;
33
- padding: 2px;
34
-
35
- }
36
- pre {
37
- border-radius: 5px;
38
- line-height: 1.1em;
39
- padding: 15px;
40
- font-size: smaller;
41
- color:#08FF08;
42
- font-family:Andale Mono;
43
- background-color:black
44
- }
45
- hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
46
- .footer { text-align:center; padding-top:30px; font-style: italic; }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <a href="https://github.com/danchoi/todo.rb"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
52
-
53
- <div id="container">
54
-
55
-
56
- <h1><a href="https://github.com/danchoi/todo.rb">todo.rb</a>
57
-
58
-
59
-
60
- <h2>Intro</h2>
61
-
62
- <p> todo.rb is a command-line todo list manager. It stores data as simple
63
- lists in flat text files and is highly interoperable with other Unix-style
64
- tools. </p>
65
-
66
- <p>
67
- Like <a href="http://wiki.43folders.com/index.php/ToDo.txt">Merlin Mann</a>, I
68
- used to edit my todo lists in Vim.
69
- The problem is that Vim, like every popular text editor, presents a <a
70
- href="http://books.google.com/books?id=RaPwX0sScf4C&lpg=PA93&ots=SNzsy-p8h6&dq=tenet%208%20avoid%20captive&pg=PA93#v=onepage&q&f=false">captive
71
- user interface</a> which removes you from the command line
72
- and is also more difficult to script than a standard, noninteractive Unix tool.
73
- </p>
74
-
75
- <p>todo.rb was designed to avoid these problems. It is a small, sharp,
76
- Unix-style tool for managing lists, especially todo lists.</p>
77
-
78
- <p>One notable thing about
79
- todo.rb is that it uses the ancient and venerable Unix text editor <a
80
- href="http://en.wikipedia.org/wiki/Ed_%28text_editor%29">ed</a> under the hood
81
- to let you perform a wide range of edits on your todo.txt without leaving the
82
- command line or impairing scriptability. If you haven't heard of ed, ed is the <a href="http://en.wikipedia.org/wiki/Obi-Wan_Kenobi">Obi-Wan Kenobi</a> of text editors. Highly underestimated and mistaken for a useless antique, ed can do amazingly useful things.</p>
83
-
84
- <p>
85
- Inspired by <a
86
- href="http://ginatrapani.github.com/todo.txt-cli/">todo.sh</a> by Gina
87
- Trapani, todo.rb carries that idea further in the direction of the
88
- <a href="http://www.faqs.org/docs/artu/ch01s06.html">Unix philosophy</a>.
89
- </p>
90
-
91
-
92
- <h2>Requires</h2>
93
- <p>Ruby 1.9</p>
94
-
95
- <h2>Install</h2>
96
- <pre>$ gem install todo.rb</pre>
97
-
98
- <h2>Basics</h2>
99
-
100
- <p>
101
- The full command name is todo.rb, but you'll probably want to
102
- alias it to something shorter. Put something like this in your
103
- ~/.bash_profile or ~/.bashrc:
104
- </p>
105
-
106
- <pre>alias t=todo.rb</pre>
107
-
108
- <p>
109
- This is a detailed guide to the program. You can type this to get help from the command line:
110
- </p>
111
-
112
- <pre>
113
- $ t -h
114
- </pre>
115
-
116
- <p>todo.rb operates in the current working directory. It looks for a todo.txt
117
- and done.txt file, and creates them if they don't already exist.
118
- </p>
119
-
120
- <pre>
121
- $ t
122
- Missing a todo.txt file. Creating.
123
- Missing a done.txt file. Creating.
124
- </pre>
125
-
126
- <p>
127
- You can start adding tasks like this.
128
- </p>
129
-
130
- <pre>
131
- $ t @harvardsq buy some assam from tealuxe
132
- 0a1
133
- > @harvardsq buy some assam from tealuxe
134
- </pre>
135
-
136
- <p>
137
- @harvardsq is a <strong>context tag</strong> for your task. A context tag usually indicates a
138
- location, but it can also represent an activity, like @email. The two lines you
139
- see after the command prompt is a diff showing the change you just made.
140
- </p>
141
-
142
- <p>
143
- To see the tasks we have accumulated so far, just press t.
144
- </p>
145
-
146
- <pre>
147
- $ t
148
- 1 <span style='color:#00FFFF'>@harvardsq</span> buy some assam from tealuxe
149
- </pre>
150
-
151
- <p>
152
- If you look in the file todo.txt, you'll see that all todo.rb is doing besides
153
- printing the file is adding line numbers and coloring the context tags.
154
- </p>
155
-
156
- <p>
157
- There is another type of tag you can use when you add tasks: a <strong>project tag</strong>.
158
- It looks like this:
159
- </p>
160
-
161
- <pre>
162
- $ t +opensource release todo.rb
163
- 1a2
164
- > +opensource release todo.rb
165
- </pre>
166
-
167
- <p>
168
- A project tag need not represent an actual project. It can stand for a topic, a
169
- feature, or whatever.
170
- </p>
171
-
172
- <p>
173
- When you print the task list, you'll see that project tags and context tags are
174
- colored differently.
175
- You can also have more than one tag per task, and you can mix project and context tags.
176
- </p>
177
-
178
- <pre>
179
- $ t
180
- 1 <span style='color:#00FFFF'>@harvardsq</span> buy some assam from tealuxe
181
- 2 <span style='color:#DC143C'>+opensource</span> release todo.rb
182
- </pre>
183
-
184
- <p>
185
- Let's add one more task to the @harvardsq context.
186
- </p>
187
-
188
- <pre>
189
- $ t @harvardsq buy more moleskine notebooks
190
- 2a3
191
- > @harvardsq buy more moleskine notebooks
192
-
193
- $ t
194
- 1 <span style='color:#00FFFF'>@harvardsq</span> buy some assam from tealuxe
195
- 2 <span style='color:#DC143C'>+opensource</span> release todo.rb
196
- 3 <span style='color:#00FFFF'>@harvardsq</span> buy more moleskine notebooks
197
- </pre>
198
-
199
- <p>
200
- So when you type <code>t [tag] [task]</code> a new task will be created and tagged.
201
- If you don't want to provide a tag, or if you want to put the tag after the first word
202
- in your task, or if you want to insert a task somewhere other than at the bottom of your todo list,
203
- you need to use another syntax to create a task, a syntax which is based on `ed` commands.
204
- This is described below. </p>
205
-
206
- <p>
207
- This is how you <strong>reorder tasks</strong>:
208
- </p>
209
-
210
-
211
- <pre>
212
- $ t 3m0
213
- 0a1
214
- > @harvardsq buy more moleskine notebooks
215
- 3d3
216
- < @harvardsq buy more moleskine notebooks
217
-
218
- $ t
219
- 1 <span style='color:#00FFFF'>@harvardsq</span> buy more moleskine notebooks
220
- 2 <span style='color:#00FFFF'>@harvardsq</span> buy some assam from tealuxe
221
- 3 <span style='color:#DC143C'>+opensource</span> release todo.rb
222
- </pre>
223
-
224
- <p> The <code>3m0</code> is an <strong>ed script</strong>. That's right, todo.rb delegates a
225
- lot of commands to <a
226
- href="http://en.wikipedia.org/wiki/Ed_%28text_editor%29">ed, the venerable Unix
227
- text editor</a>. This gives you a lot of power to edit your todo list from the
228
- command line with very succinct commands, and without disrupting your command
229
- line workflow.
230
- </p>
231
-
232
- <p>So if you wanted to delete the first task, you would use <code>t 1d</code>.
233
- If you wanted to delete a range, you could use something like <code>t 1,3d</code>.
234
- </p>
235
-
236
- <p>
237
- If you want to insert text via an ed
238
- command sequence, put a space after the ed motion
239
- command, followed by the text to insert. Put quotes around the text if it
240
- contains any characters you don't want interpreted by the shell.
241
- </p>
242
-
243
-
244
- <p>So for example, this would append a new task after line 3:</p>
245
-
246
- <pre>
247
- $ t 3a 'buy some fresh basil @traderjoes'
248
- </pre>
249
-
250
- <p> Remember, you do <strong>not</strong> have to use ed commands all the time.
251
- You can always open the todo.txt file and edit it directly in a more conventional
252
- text editor like Vim, Emacs, or TextEdit. You can also use Unix commands like
253
- <code>cat &gt;&gt; todo.txt</code> or <code>echo 'buy arugla @wholefoods' >> todo.txt</code> to add
254
- tasks. You have many options, and the data format of the todo.txt file is so
255
- simple that there is almost no way you can accidentally corrupt it. But
256
- it's possible to overwrite or delete the file accidentally, so please keep it
257
- backed up or under version control.</p>
258
-
259
- <p>
260
- The "do" command marks tasks as done.
261
- </p>
262
-
263
- <pre>
264
- $ t do 2
265
- 2d1
266
- < @harvardsq buy some assam from tealuxe
267
- </pre>
268
-
269
- <p>Now watch this:</p>
270
-
271
- <pre>
272
- $ t do /moleskine/
273
- 1d0
274
- < @harvardsq buy more moleskine notebooks
275
- </pre>
276
-
277
- <p>
278
- Here we used a <strong>regular expression</strong> instead of a line number to grab the task.
279
- This is possible because we are farming out work to `ed`.
280
- Tasks can be identified with ed-style <strong>addressing</strong>.
281
- So in the earlier example, instead of using <code>t 3m0</code>, we could have moved the task
282
- with <code>t /notebook/m0</code>.
283
- </p>
284
-
285
- <p>
286
- Addressing with regular expressions saves you from having to print the list to look up
287
- task line numbers. You can just "use the force," so to speak, and manipulate your
288
- todo.txt using your memory of the tasks that are in there.
289
- </p>
290
-
291
- <p>For example, you could use regex to move the first item with the word "exercise" in it to after the first item with
292
- the word "deadline" in it:</p>
293
-
294
- <pre>
295
- t /exercise/m/deadline
296
- </pre>
297
-
298
- <p>The closing '/' is optional.</p>
299
-
300
- <p> You can do batch manipulations with regular expressions too, using ed's
301
- concise search and replace syntax. For example, running
302
- </p>
303
-
304
- <pre>
305
- t ,s/@apple/@orange/g
306
- </pre>
307
-
308
- <p>
309
- would change all the @apple tags in your todo list to @orange tags. Read more about `ed` commands
310
- using <code>man ed</code>.
311
- </p>
312
-
313
- <p>
314
- What's the difference between <code>t 2d</code> and <code>t do 2</code>? The first command simply deletes a task.
315
- The second command moves it to the done.txt file and timestamps it with the date of
316
- completion. You can display done tasks with the "done" command.
317
- </p>
318
-
319
- <pre>
320
- $ t done
321
- 1 2012-01-29 <span style='color:#00FFFF'>@harvardsq</span> buy some assam from tealuxe
322
- 2 2012-01-29 <span style='color:#00FFFF'>@harvardsq</span> buy more moleskine notebooks
323
- </pre>
324
-
325
- <p>
326
- To undo a task, use "undo" along with the ed address of the done item.
327
- </p>
328
-
329
- <pre>
330
- $ t undo 2
331
- 1a2
332
- > @harvardsq buy more moleskine notebooks
333
-
334
- $ t
335
- 1 <span style='color:#DC143C'>+opensource</span> release todo.rb
336
- 2 buy fresh basil <span style='color:#00FFFF'>@traderjoes</span>
337
- 3 <span style='color:#00FFFF'>@harvardsq</span> buy more moleskine notebooks
338
- </pre>
339
-
340
- <p>
341
- You can <strong>filter</strong> tasks by tag like this:
342
- </p>
343
-
344
- <pre>
345
- $ t @harvardsq
346
- 3 <span style='color:#00FFFF'>@harvardsq</span> buy more moleskine notebooks
347
- </pre>
348
-
349
- <p>
350
- You can also <strong>abbreviate tags</strong>. todo.rb will expand the
351
- abbreviated tag to the first tag it finds that matches the abbreviation.
352
- <p>
353
-
354
- <pre>
355
- $ t @h
356
- 3 <span style='color:#00FFFF'>@harvardsq</span> buy more moleskine notebooks
357
- </pre>
358
-
359
- You can list both incomplete and done tasks with the "all" command. You can
360
- pass a context or project tag to "all" to filter the list by that tag.
361
- Again, you can use abbrevation.
362
- </p>
363
-
364
- <pre>
365
- $ t all @h
366
- todo
367
- 3 <span style='color:#00FFFF'>@harvardsq</span> buy more moleskine notebooks
368
-
369
- done
370
- 1 2012-01-29 <span style='color:#00FFFF'>@harvardsq</span> buy some assam from tealuxe
371
- </pre>
372
-
373
-
374
- <p>
375
- There is one more way to highlight and filter items, and that is by flagging
376
- tasks as <strong>high priority</strong>. A task is deemed to be high
377
- priority if it contains an <strong>exclamation mark</strong>.
378
- You can prioritize an action with the "pri" command and deprioritize it with the "depri" command.
379
- The "pri" command adds an exclamation mark to the end of the task and moves it to the
380
- top of the list.
381
- </p>
382
-
383
- <pre>
384
- $ t pri /notebook/
385
- 0a1
386
- > @harvardsq buy more moleskine notebooks !
387
- 3d3
388
- < @harvardsq buy more moleskine notebooks
389
-
390
- $ t
391
- <span style='color:#FFFF00'> 1 </span><span style='color:#00FFFF'>@harvardsq</span><span style='color:#FFFF00'> buy more moleskine notebooks !</span>
392
- 2 <span style='color:#DC143C'>+opensource</span> release todo.rb
393
- 3 buy fresh basil <span style='color:#00FFFF'>@traderjoes</span>
394
- </pre>
395
-
396
- <p>If a task contains three exclamation points in a row [!!!], the item will actually flash. I'll spare you that
397
- demonstration, because blinking text is very annoying. I included this feature because sometimes annoying is what you want from
398
- a todo list.</p>
399
-
400
-
401
- <p>To filter the list to show just priority items, use
402
- t ! or t ! followed by a tag or tag abbreviation:</p>
403
-
404
- <pre>
405
- $ t ! @h
406
- <span style='color:#FFFF00'> 1 </span><span style='color:#00FFFF'>@harvardsq</span><span style='color:#FFFF00'> buy more moleskine notebooks !</span>
407
- </pre>
408
-
409
- <p>To see a simple report of your tasks:</p>
410
-
411
- <pre>
412
- $ t report
413
- tag priority todo done
414
- -------------- -------- -------- --------
415
- <span style='color:#DC143C'>+opensource</span> 0 1 0
416
- <span style='color:#00FFFF'>@harvardsq</span> 1 1 1
417
- <span style='color:#00FFFF'>@traderjoes</span> 0 1 0
418
- </pre>
419
-
420
-
421
- <h2>Extras</h2>
422
-
423
- <p>If you want to undo a destructive action, you can use the "revert" command:</p>
424
-
425
- <pre>t revert</pre>
426
-
427
- <p>
428
- Before changing todo.txt, todo.rb backs up todo.txt as .todo.txt.bkp. The
429
- revert command just swaps the two files. If you're versioning your todo.txt and done.txt files
430
- with Git, you can also use "git revert", "git stash" and similar commands
431
- to achieve the same effect.
432
- </p>
433
-
434
- <p>If you don't want colored output, use the -C flag after t.</p>
435
-
436
- <p>
437
- todo.rb also lets you <strong>customize colors</strong>. It will look for a colors.yml
438
- file in the current directory or in ~/.todo.rb/. The colors.yml file can specify
439
- the color for high priority items, default colors for context and project tags,
440
- as well as special colors for particular tags.
441
- </p>
442
-
443
- <p>For example, this colors.yml</p>
444
-
445
- <pre>
446
- priority: fuchsia
447
- context: ff69b4
448
- project: ffebcd
449
- @harvardsq: ddaa00
450
- </pre>
451
-
452
-
453
- <p>
454
- would color the output like this:
455
- </p>
456
-
457
- <pre>
458
- 1 <span style='color:#FFEBCD'>+opensource</span> release todo.rb
459
- 2 buy fresh basil <span style='color:#FF0000'>@traderjoes</span>
460
- <span style='color:#FF00FF'> 3 </span><span style='color:#DDAA00'>@harvardsq</span><span style='color:#FF00FF'> buy more moleskine notebooks!</span>
461
- </pre>
462
-
463
-
464
- <h2>Tips</h2>
465
-
466
- <p>
467
- I keep a global todo list in ~/todo/todo.txt and per-project todo.txt
468
- files in project folders. I use t as an alias for todo.rb to manage project todo.txt files.
469
- For managing the global todo.txt, I added this bash function to ~/.bash_profile to let
470
- me use `tt` to edit the global todo list from any directory:
471
- </p>
472
-
473
- <pre>
474
- function tt() {
475
- pushd ~/todo && t $@
476
- popd
477
- }
478
- </pre>
479
-
480
- <p>You can use this same technique to wrap todo.rb in a bash function that does
481
- pre- and post-processing, such as pulling changes from an upstream git repository,
482
- committing new changes to git, and pushing those changes upstream.</p>
483
-
484
- <pre>
485
- function ttgit() {
486
- pushd ~/todo
487
- git pull
488
- t $@
489
- git commit -a -m "edit" 2> /dev/null
490
- git push
491
- popd
492
- }
493
- </pre>
494
-
495
- <p>I synchronize the folder containing my todo.txt, done.txt, and colors.yml
496
- across my computers using a private upstream GitHub repository. You can also use Dropbox.</p>
497
-
498
- <p>You can easily pipe todo.rb output into other Unix tools like
499
- <strong>head</strong>, <strong>grep</strong>, <strong>lpr</strong>, or
500
- <strong>mail</strong>.</p>
501
-
502
- <p>
503
- For example, if you have a long list of tasks and you want to stay focused on the top items, you
504
- can do this:
505
- </p>
506
-
507
- <pre>
508
- t | head -5
509
- </pre>
510
-
511
- <p>
512
- To reverse the order of tasks, so that the lowest-numbered are output last:
513
- </p>
514
-
515
- <pre>
516
- t | sort -r
517
- </pre>
518
-
519
-
520
- <p>
521
- Because todo.rb is a standard, non-interactive Unix command-line program and
522
- todo.txt is a regular text file, you can go wild automating your information flows with Unix scripts.
523
- </p>
524
-
525
- <p>
526
- All of the following scripts would be simple to write:
527
- </p>
528
-
529
- <p>
530
- You can write crontasks to scan your todo.txt for items with dates and times in
531
- them and send you email reminders when things are due.
532
- </p>
533
-
534
- <p>
535
- You can write a program to poll your Gmail inbox for emails
536
- matching certain rules and create tasks from the subject lines of those emails.
537
- </p>
538
-
539
- <p>
540
- You can write a script to publish your todo list to a webserver and to
541
- automatically update it when the todo list changes. This lets you access your todo lists
542
- from any computer or mobile device, as well as share them with others.
543
- </p>
544
-
545
-
546
- </ul>
547
-
548
-
549
- <h2>Feedback</h2>
550
-
551
- <p>
552
- Your feedback is welcome. You can leave it on the <a href="https://github.com/danchoi/todo.rb/issues">GitHub issue tracker</a>.
553
- </p>
554
-
555
-
556
- <h2>Source</h2>
557
- <p>You can also clone the project with <a href="http://git-scm.com">Git</a>
558
- by running:
559
- <pre>$ git clone git://github.com/danchoi/todo.rb</pre>
560
- </p>
561
-
562
-
563
-
564
-
565
- <div class="footer">
566
- get the source code on GitHub : <a href="https://github.com/danchoi/todo.rb">danchoi/todo.rb</a>
567
- </div>
568
-
569
- </div>
570
-
571
- </body>
572
- </html>