todo.txt 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +77 -6
- data/lib/todo/cli/cmd.rb +23 -1
- data/lib/todo/cli/list.rb +1 -1
- data/lib/todo/cli/toggle.rb +10 -1
- data/lib/todo/cli.rb +0 -4
- data/lib/todo/data/list.rb +2 -2
- data/lib/todo/data/matcher.rb +1 -1
- data/lib/todo/version.rb +1 -1
- data/lib/todo.rb +3 -0
- metadata +1 -2
- data/NOTES.md +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9005f5878ad1e85af811526c8a82ad566d096ca2
|
4
|
+
data.tar.gz: 8874fd1b652471cb6476ecdb3e939c490b2f263a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b55d6efd15701f7228361db0b20386d721872c077d461b1be734d5076344c1c813269f016f601ae9d39d4602d36ca47a8afe5fb7a59cff60b335f272485b54b
|
7
|
+
data.tar.gz: e8a653e2279bdf69eeaa4afd53f8d1447773970376fe10fefe5e4279ab1b58dd0f74d74c41c02fcef2618553533728f01b2a209c1b8edc87bcfa588df898df88
|
data/README.md
CHANGED
@@ -1,11 +1,82 @@
|
|
1
1
|
# TODO.txt
|
2
2
|
|
3
|
-
My
|
3
|
+
- My personal flavor of the format. [Todo.txt](https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format)
|
4
4
|
|
5
|
-
|
5
|
+
## Assumptions
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
* Vim mapping to [archive](https://github.com/svenfuchs/vim-todo.txt/blob/master/ftplugin/todo.vim#L3) done items to a separate file
|
10
|
-
* [launchctl](https://github.com/svenfuchs/todo.txt/blob/master/etc/me.todo-watch.plist) to `fswatch` the file, and [git push](https://github.com/svenfuchs/todo.txt/blob/master/bin/push) changes to a Gist
|
7
|
+
These are my personal opinions, and probably due to how I am used to use my
|
8
|
+
todo.txt file personally. Your mileage will most probably vary.
|
11
9
|
|
10
|
+
* Being able to embed todo.txt item lines into arbirary text files, and format
|
11
|
+
a todo.txt file freely (adding section titles, comments, bullet point lists
|
12
|
+
etc) is a good thing. A tool must play nice with this and must not rewrite
|
13
|
+
any custom formatting.
|
14
|
+
* An item can belong to one or many projects.
|
15
|
+
* The concept of "contexts" (phone, work, home) seems like a stale from the GTD
|
16
|
+
era. Does anybody actually use this? Also, the format `@name` indicates a
|
17
|
+
person in most contexts nowadays.
|
18
|
+
* Assigning explicit priorities don't really work well. Re-ordering items on
|
19
|
+
the todo.txt list works better.
|
20
|
+
* A concept of generic key/value pairs seems like a useful addition to make the
|
21
|
+
format more flexible and adaptable. These also can be used for, e.g. due and
|
22
|
+
done dates (as well as contexts and priorities, if they still seem useful).
|
23
|
+
* In order to integrate with services and other tools it seems useful to add
|
24
|
+
the concept of an `id`. I'll use `[id]` for this. Typing ids is a hassle, so
|
25
|
+
the tool should add them automatically.
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
The gem comes with a command line executable, which plays nice with stdin and
|
30
|
+
command line arguments. It makes most sense when integrated with another UI
|
31
|
+
such as an editor. I'm using a simple VIM integration.
|
32
|
+
|
33
|
+
```
|
34
|
+
# Input files and stdin
|
35
|
+
|
36
|
+
$ cat todo.txt | todo toggle foo # outputs to stdout
|
37
|
+
$ todo toggle foo --file todo.txt # specify the file to work with
|
38
|
+
$ todo toggle foo # should assume ./TODO.txt but i can't figure
|
39
|
+
# this out, see https://github.com/svenfuchs/todo.txt/blob/master/lib/todo/cli/cmd.rb#L29
|
40
|
+
|
41
|
+
# Filtering items
|
42
|
+
|
43
|
+
$ todo list --since yesterday # by done date
|
44
|
+
$ todo list --since 2015-12-01 --before 2015-11-01 # by done date
|
45
|
+
$ todo list --status pending # by status
|
46
|
+
$ todo list --status done # by status
|
47
|
+
$ todo list --project foo # by project
|
48
|
+
$ todo list --project foo --project bar # by project
|
49
|
+
$ todo list --text foo # by text
|
50
|
+
$ todo list foo # by text
|
51
|
+
$ todo list foo --since 2015-12-01 --status done # by text, done date, and status
|
52
|
+
|
53
|
+
Named dates are: one_month_ago, two_weeks_ago, one_week_ago: two_days_ago,
|
54
|
+
yesterday, today.
|
55
|
+
|
56
|
+
# Formats
|
57
|
+
|
58
|
+
$ todo list --format short
|
59
|
+
$ todo list --format full
|
60
|
+
|
61
|
+
# Toggling
|
62
|
+
|
63
|
+
$ todo toggle foo
|
64
|
+
$ todo toggle --text foo
|
65
|
+
$ todo toggle -- '- foo' # passing a full item line with a leading `-`
|
66
|
+
|
67
|
+
# Archiving
|
68
|
+
|
69
|
+
$ todo archive --since 2015-12-01
|
70
|
+
$ todo archive # defaults to: two weeks ago
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
## Vim integration
|
75
|
+
|
76
|
+
* Vim mapping to a todo item status [toggle](https://github.com/svenfuchs/vim-todo.txt/blob/master/ftplugin/todo.vim#L1)
|
77
|
+
* Vim mapping to done items to idonethis [push](https://github.com/svenfuchs/vim-todo.txt/blob/master/ftplugin/todo.vim#L2)
|
78
|
+
* Vim mapping to done items to a separate file [archive](https://github.com/svenfuchs/vim-todo.txt/blob/master/ftplugin/todo.vim#L3)
|
79
|
+
|
80
|
+
## Mac OSX integration
|
81
|
+
|
82
|
+
* to `fswatch` the file, and [git changes to a Gist [launchctl](https://github.com/svenfuchs/todo.txt/blob/master/etc/me.todo-watch.plist) push](https://github.com/svenfuchs/todo.txt/blob/master/bin/push)
|
data/lib/todo/cli/cmd.rb
CHANGED
@@ -10,17 +10,39 @@ module Todo
|
|
10
10
|
extend Support::OptionsParser
|
11
11
|
include Helpers::Hash::Slice
|
12
12
|
|
13
|
+
def self.normalize_date(date)
|
14
|
+
DATES[date.to_sym] ? DATES[date.to_sym] : date
|
15
|
+
end
|
16
|
+
|
13
17
|
opt '-f', '--file FILENAME', 'Filename' do |opts, file|
|
14
18
|
opts[:file] = file
|
15
19
|
end
|
16
20
|
|
17
21
|
def io
|
18
|
-
|
22
|
+
if opts[:file]
|
23
|
+
Src::File.new(opts[:file])
|
24
|
+
else
|
25
|
+
Src::Io.new(slice(opts, :in, :out))
|
26
|
+
end
|
19
27
|
end
|
20
28
|
|
21
29
|
def render(list, opts = {})
|
22
30
|
View.new(list, opts).render
|
23
31
|
end
|
32
|
+
|
33
|
+
# TODO how to test if stdin is attached?
|
34
|
+
#
|
35
|
+
# def stdin?
|
36
|
+
# !$stdin.eof? # blocks
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# def stdin?
|
40
|
+
# $stdin.read_nonblock(1)
|
41
|
+
# $stdin.seek(-1) # can't seek on stdin?
|
42
|
+
# true
|
43
|
+
# rescue IO::EAGAINWaitReadable
|
44
|
+
# false
|
45
|
+
# end
|
24
46
|
end
|
25
47
|
end
|
26
48
|
end
|
data/lib/todo/cli/list.rb
CHANGED
data/lib/todo/cli/toggle.rb
CHANGED
@@ -5,6 +5,14 @@ require 'todo/data/parser'
|
|
5
5
|
module Todo
|
6
6
|
class Cli
|
7
7
|
class Toggle < Cmd
|
8
|
+
opt '-i', '--id ID', 'ID' do |opts, id|
|
9
|
+
opts[:id] = id
|
10
|
+
end
|
11
|
+
|
12
|
+
opt '-t', '--text TEXT', 'Text' do |opts, text|
|
13
|
+
opts[:text] = text
|
14
|
+
end
|
15
|
+
|
8
16
|
def run
|
9
17
|
list = Data::List.parse(io.read)
|
10
18
|
list.toggle(data)
|
@@ -14,7 +22,8 @@ module Todo
|
|
14
22
|
private
|
15
23
|
|
16
24
|
def data
|
17
|
-
data = Data::Parser.new(args.first).parse
|
25
|
+
data = Data::Parser.new(args.first.to_s).parse
|
26
|
+
data = data.merge(slice(opts, :id, :text))
|
18
27
|
slice(data, :id, :text)
|
19
28
|
end
|
20
29
|
end
|
data/lib/todo/cli.rb
CHANGED
data/lib/todo/data/list.rb
CHANGED
@@ -56,8 +56,8 @@ module Todo
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def validate(data, list)
|
59
|
-
raise Error.new(MSGS[:item_not_found] % to_pairs(data)) if list.size == 0
|
60
|
-
raise Error.new(MSGS[:multiple_items] % to_pairs(data)) if list.size > 1
|
59
|
+
raise Error.new(MSGS[:item_not_found] % to_pairs(data).join(' ')) if list.size == 0
|
60
|
+
raise Error.new(MSGS[:multiple_items] % to_pairs(data).join(' ')) if list.size > 1
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/lib/todo/data/matcher.rb
CHANGED
data/lib/todo/version.rb
CHANGED
data/lib/todo.rb
CHANGED
@@ -6,7 +6,10 @@ module Todo
|
|
6
6
|
}
|
7
7
|
|
8
8
|
DATES = {
|
9
|
+
one_month_ago: (Time.now - 60 * 60 * 24 * 31).strftime('%Y-%m-%d'),
|
9
10
|
two_weeks_ago: (Time.now - 60 * 60 * 24 * 14).strftime('%Y-%m-%d'),
|
11
|
+
one_week_ago: (Time.now - 60 * 60 * 24 * 7).strftime('%Y-%m-%d'),
|
12
|
+
two_days_ago: (Time.now - 60 * 60 * 24 * 2).strftime('%Y-%m-%d'),
|
10
13
|
yesterday: (Time.now - 60 * 60 * 24).strftime('%Y-%m-%d'),
|
11
14
|
today: Time.now.strftime('%Y-%m-%d')
|
12
15
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: todo.txt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
@@ -19,7 +19,6 @@ files:
|
|
19
19
|
- Gemfile
|
20
20
|
- Gemfile.lock
|
21
21
|
- MIT-LICENSE
|
22
|
-
- NOTES.md
|
23
22
|
- README.md
|
24
23
|
- lib/todo.rb
|
25
24
|
- lib/todo/cli.rb
|
data/NOTES.md
DELETED
File without changes
|