todo-jsonl 0.1.28 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/todo.rb +11 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2869302296a5a0ab3af889b0a76926cfba6d59552d5e4103524dae1ae3e7fd50
4
- data.tar.gz: f2d7d03e8b62139d3197386c44391caf4a9d4fae545012389272cebdca61c3d9
3
+ metadata.gz: 2af368dfb4ac9e0f8e6448e005bb7242c509d6bf0ce1e97bdc8783629c3dd77f
4
+ data.tar.gz: dc5f0da8574ea5bda98627c122e9a0bdc7c3d661cba879c4ac09bff3cdb075ba
5
5
  SHA512:
6
- metadata.gz: 40c72337ffd6a818adf28ef001cbd3b4f365af92d1fecd9a36ea361522a2125d83500ed76d4633df228c2c87a987083b08541452e7129af914452e7ca6652563
7
- data.tar.gz: 6f42e59df9b34c140f3c6bba11010f0b6a3f7a3c45d1c7b23d5ded213ee2562e62a963b3e889a6886b97ff991e49e78af6efccf898fd951220c1cad8bcb2f66d
6
+ metadata.gz: 1d0b4562ca3af2722f5fb2eb594f248ccaf2b69b18eb2a7f2e19f386da1f60352260631a7afd53e5cf375a3f7c37297a85808a701870b0c2eb73efe9797416e8
7
+ data.tar.gz: 030be81b91d66d0d084dff2c805df49cc1f2705aa020d607a06003d542a139e0f6b6708d307a6e448e14c0ca76b135878e643c5ab54132ac457be506cea43b4f
data/bin/todo.rb CHANGED
@@ -129,6 +129,7 @@ class Todo
129
129
  rescue => error
130
130
  puts "#{colorize('ERROR:', :red)} #{error}"
131
131
  end
132
+ self
132
133
  end
133
134
 
134
135
  private
@@ -177,15 +178,15 @@ class Todo
177
178
  due_dates_for_queries = next_7_days.map do |day| day.strftime(DATE_FORMAT) end
178
179
 
179
180
  @queries = {
180
- ':active' => 'state=(new|started|blocked)',
181
- ':done' => 'state=done',
182
- ':blocked' => 'state=blocked',
183
- ':started' => 'state=started',
184
- ':new' => 'state=new',
185
- ':all' => 'state=\w+',
186
- ':today' => "due=#{due_dates_for_queries[0]}",
187
- ':tomorrow' => "due=#{due_dates_for_queries[1]}",
188
- ':next7days' => "due=(#{due_dates_for_queries.join('|')})"
181
+ ':active' => lambda do |task| /(new|started|blocked)/.match(task[:state]) end,
182
+ ':done' => lambda do |task| 'done' == task[:state] end,
183
+ ':blocked' => lambda do |task| 'blocked' == task[:state] end,
184
+ ':started' => lambda do |task| 'started' == task[:state] end,
185
+ ':new' => lambda do |task| 'new' == task[:state] end,
186
+ ':all' => lambda do |task| /\w+/.match(task[:state]) end,
187
+ ':today' => lambda do |task| due_dates_for_queries[0] == task[:due] end,
188
+ ':tomorrow' => lambda do |task| due_dates_for_queries[1] == task[:due] end,
189
+ ':next7days' => lambda do |task| /(#{due_dates_for_queries.join('|')})/.match(task[:due]) end
189
190
  }
190
191
  end
191
192
 
@@ -374,10 +375,9 @@ class Todo
374
375
  def filter_tasks(tasks, patterns)
375
376
  items = {}
376
377
  tasks.each do |num, task|
377
- normalized_task = "state=#{task[:state]} due=#{task[:due]} #{task[:title]}"
378
378
  match = true
379
379
  patterns.each do |pattern|
380
- match = false unless /#{@queries[pattern] || pattern}/ix.match(normalized_task)
380
+ match = false unless @queries[pattern] ? @queries[pattern].call(task) : /#{pattern}/ix.match(task[:title])
381
381
  end
382
382
  items[num] = task if match
383
383
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todo-jsonl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.28
4
+ version: 0.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabor Bata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: