todo-jsonl 0.1.30 → 0.1.31

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 +4 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e18e67f8684606fee2693456e247af3edd78926e4d022a12f96c3b255dab3e1c
4
- data.tar.gz: 93c21f98eece4e5fce236c5f485073a3d9b052be489cc30dca25a59bab2413e2
3
+ metadata.gz: 9ef8eba60ead95705dc2479f4f40fc9e25989b99b25a429de36c6703dca61196
4
+ data.tar.gz: 9e161dd022343525a4d1e4fd94c214763edc9a57796f3955a510082acda95515
5
5
  SHA512:
6
- metadata.gz: 6addcea04123ade9a05649cf9d6b9ac569a23f6210b103fc715076cadd6775c0ca738cb6a3b3733f28270d66cb1e4d7bbe21a92b20c51b4a2e032b40b7942fed
7
- data.tar.gz: 8131e3ccc7e5e28168b16582bb989474b79257284a0effc9d072acfe18844de6684873e295fc99da89535ddefb8a5ab1fcf85ce3e4d968828cff6973224d1151
6
+ metadata.gz: ba7a785128d5f7fddac436e7d2b069f3b96f69fd8f37240e06f8b2382d113391cafaf64b9cb4a48ce0260ef305b292039a40f065c8ff0188509273cad01e79c3
7
+ data.tar.gz: a7d648320d0ff43680a3f6707094749b8f2f117798aafb6c0a0b94a6e625ee48d4f747b79d531fb00fb7d701094141d6a5c4a814895f240ce9fa51a1acfa6a0a
data/bin/todo.rb CHANGED
@@ -300,18 +300,16 @@ class Todo
300
300
  tasks = tasks || load_tasks
301
301
  task_indent = [tasks.keys.max.to_s.size, 4].max
302
302
  patterns = patterns.nil? || patterns.empty? ? [':active'] : patterns
303
- items = filter_tasks(tasks, patterns)
304
- items = items.sort_by do |num, task|
303
+ items = filter_tasks(tasks, patterns).sort_by do |num, task|
305
304
  [task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num]
306
305
  end
307
306
  items.each do |num, task|
308
307
  state = task[:state] || 'default'
309
- color = COLORS[state]
310
- display_state = colorize(STATES[state], color)
308
+ display_state = colorize(STATES[state], COLORS[state])
311
309
  title = task[:title].gsub(CONTEXT_TAG_PATTERN) do |tag|
312
310
  (tag.start_with?(' ') ? ' ' : '') + colorize(tag.strip, :cyan)
313
311
  end
314
- priority_flag = task[:priority] ? colorize(PRIORITY_FLAG, :red) : ' '
312
+ priority_flag = task[:priority] && state != 'done' ? colorize(PRIORITY_FLAG, :red) : ' '
315
313
  due_date = ''
316
314
  if task[:due] && state != 'done'
317
315
  date_diff = (Date.strptime(task[:due], DATE_FORMAT) - @today).to_i
@@ -385,7 +383,7 @@ class Todo
385
383
  end
386
384
 
387
385
  def colorize(text, color)
388
- "\e[#{COLOR_CODES[color]}m#{text}\e[0m"
386
+ "\e[#{COLOR_CODES[color] || 37}m#{text}\e[0m"
389
387
  end
390
388
 
391
389
  def convert_due_date(date)
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.30
4
+ version: 0.1.31
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-11 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: