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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbbe3c577a2ed572182c84fc0529403187a78d76
4
- data.tar.gz: 955a861d58cbabfccf886e2c9fd4ea8e9520a9da
3
+ metadata.gz: 9005f5878ad1e85af811526c8a82ad566d096ca2
4
+ data.tar.gz: 8874fd1b652471cb6476ecdb3e939c490b2f263a
5
5
  SHA512:
6
- metadata.gz: 52552da4e560a61f35007feab5dcab4c5962e5defb01792885adf71ab7170d8eac923173020d089133e56b71ee75b93e3540f81649169a1c6d0746af2d2a9a7b
7
- data.tar.gz: 8bed646c7f788d9aa5a134fa271c05b8e887986371663da9b5030e6d7ad82162b57d3acf03a73547feff0693cee01d3518f67e2e47d8dd74ef48071fb63f8f84
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 version of the [Todo.txt](https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format) format.
3
+ - My personal flavor of the format. [Todo.txt](https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format)
4
4
 
5
- Integration:
5
+ ## Assumptions
6
6
 
7
- * Vim mapping to [toggle](https://github.com/svenfuchs/vim-todo.txt/blob/master/ftplugin/todo.vim#L1) a todo item status
8
- * Vim mapping to [push](https://github.com/svenfuchs/vim-todo.txt/blob/master/ftplugin/todo.vim#L2) done items to idonethis
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
- opts[:file] ? Src::File.new(opts[:file]) : Src::Io.new(slice(opts, :in, :out))
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
@@ -4,7 +4,7 @@ require 'todo/data/list'
4
4
  module Todo
5
5
  class Cli
6
6
  class List < Cmd
7
- opt '-f', '--format FORMAT', 'Format' do |opts, format|
7
+ opt '--format FORMAT', 'Format' do |opts, format|
8
8
  opts[:format] = format
9
9
  end
10
10
 
@@ -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
@@ -26,10 +26,6 @@ module Todo
26
26
 
27
27
  private
28
28
 
29
- def normalize_date(date)
30
- DATES[date.to_sym] ? DATES[date.to_sym] : date
31
- end
32
-
33
29
  def const
34
30
  @const ||= Cli.const_get(camelize(cmd))
35
31
  rescue NameError
@@ -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
@@ -32,7 +32,7 @@ module Todo
32
32
  end
33
33
 
34
34
  def match_text
35
- item.text.include?(data[:text])
35
+ item.text.include?(data[:text]) unless data[:text].empty?
36
36
  end
37
37
 
38
38
  def match_projects
data/lib/todo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Todo
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
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.5
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