todo-jsonl 0.1.31 → 0.1.32
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.
- checksums.yaml +4 -4
- data/bin/todo.rb +10 -10
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70b3b87cee25e9b7f3b98d8c4fabfa9314953ab473fa845af8d5ac3865416bf3
|
4
|
+
data.tar.gz: fc60551fd9ad077cbb794c91dc94595cc8969eaeede825d42bf425b1654113f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee42c84380d64142ba3f64a9ea7deee06f874f3a9f6a9ac4142fc834a14b8f66732118ca1072d43bf484674971c37944053deff4fed89e797527b7a83fa1ff25
|
7
|
+
data.tar.gz: f79bc0d5be7041e6efcc25f1f88afa43eecf10c382d7353f6b3fa55d6752756b767152b52ab694b5999eda0bbce58ed60ba36b520b09c16309b0ee06f36f82f5
|
data/bin/todo.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# todo.rb - todo list manager
|
3
|
+
# todo.rb - todo list manager on the command-line
|
4
|
+
# inspired by todo.txt using the jsonl format.
|
4
5
|
#
|
5
6
|
# Copyright (c) 2020-2021 Gabor Bata
|
6
7
|
#
|
@@ -247,7 +248,7 @@ class Todo
|
|
247
248
|
end
|
248
249
|
end
|
249
250
|
|
250
|
-
def append(item, text
|
251
|
+
def append(item, text)
|
251
252
|
update_task(item, :list, lambda do |task|
|
252
253
|
task[:title] = [task[:title], text].join(' ')
|
253
254
|
postprocess_tags(task)
|
@@ -297,9 +298,10 @@ class Todo
|
|
297
298
|
end
|
298
299
|
|
299
300
|
def list(tasks = nil, patterns = nil)
|
300
|
-
tasks
|
301
|
+
tasks ||= load_tasks
|
301
302
|
task_indent = [tasks.keys.max.to_s.size, 4].max
|
302
|
-
patterns
|
303
|
+
patterns ||= []
|
304
|
+
patterns += [':active'] if (patterns & [':active', ':done', ':blocked', ':started', ':new', ':all']).empty?
|
303
305
|
items = filter_tasks(tasks, patterns).sort_by do |num, task|
|
304
306
|
[task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num]
|
305
307
|
end
|
@@ -341,7 +343,7 @@ class Todo
|
|
341
343
|
end
|
342
344
|
|
343
345
|
def show(item, tasks = nil)
|
344
|
-
tasks
|
346
|
+
tasks ||= load_tasks(item)
|
345
347
|
tasks[item].each do |key, value|
|
346
348
|
val = value.kind_of?(Array) ? "\n" + value.join("\n") : value
|
347
349
|
puts "#{colorize(key.to_s.rjust(10, ' ') + ':', :cyan)} #{val}"
|
@@ -365,7 +367,7 @@ class Todo
|
|
365
367
|
tasks = load_tasks
|
366
368
|
patterns = [':done'] + patterns.to_a
|
367
369
|
items = filter_tasks(tasks, patterns)
|
368
|
-
items.
|
370
|
+
items.each_key do |num| tasks.delete(num) end
|
369
371
|
write_tasks(tasks)
|
370
372
|
puts "Deleted #{items.size} todo(s)"
|
371
373
|
end
|
@@ -373,9 +375,8 @@ class Todo
|
|
373
375
|
def filter_tasks(tasks, patterns)
|
374
376
|
items = {}
|
375
377
|
tasks.each do |num, task|
|
376
|
-
match =
|
377
|
-
|
378
|
-
match = false unless @queries[pattern] ? @queries[pattern].call(task) : /#{pattern}/ix.match(task[:title])
|
378
|
+
match = patterns.uniq.all? do |pattern|
|
379
|
+
@queries[pattern] ? @queries[pattern].call(task) : /#{pattern}/ix.match(task[:title])
|
379
380
|
end
|
380
381
|
items[num] = task if match
|
381
382
|
end
|
@@ -398,7 +399,6 @@ class Todo
|
|
398
399
|
end
|
399
400
|
return due
|
400
401
|
end
|
401
|
-
|
402
402
|
end
|
403
403
|
|
404
404
|
Todo.new.execute(ARGV)
|
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.
|
4
|
+
version: 0.1.32
|
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
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -42,5 +42,6 @@ requirements: []
|
|
42
42
|
rubygems_version: 3.0.3
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
|
-
summary: todo list manager inspired by todo.txt using the jsonl
|
45
|
+
summary: todo list manager on the command-line inspired by todo.txt using the jsonl
|
46
|
+
format
|
46
47
|
test_files: []
|