todo-jsonl 0.1.25 → 0.1.28

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 +19 -16
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d47bb16f60f84f6c3e55951169bdb0871f915b7a6948844897fa8a150df05456
4
- data.tar.gz: '09600be32199c25bc946036ee947290c7c77472d00933fee39c67d9bd2dc0649'
3
+ metadata.gz: 2869302296a5a0ab3af889b0a76926cfba6d59552d5e4103524dae1ae3e7fd50
4
+ data.tar.gz: f2d7d03e8b62139d3197386c44391caf4a9d4fae545012389272cebdca61c3d9
5
5
  SHA512:
6
- metadata.gz: 3ae62a56b667ebcb55e661d1ac64cd4c2b62db7d7d4f106c79a034ca58264d4d7c3ea20a4d262e4386806baa88d472c88dcc5a6946c4d3ca8eb01bbc3d99363e
7
- data.tar.gz: ede2f1f9f155ce5ff5acacdd784b030c01e11f14a4ef6d85e5223663dc3a0dea5a2ab8a3eac95f498808747fa9588723d1feef36828e4657ee23cd41736aa4e0
6
+ metadata.gz: 40c72337ffd6a818adf28ef001cbd3b4f365af92d1fecd9a36ea361522a2125d83500ed76d4633df228c2c87a987083b08541452e7129af914452e7ca6652563
7
+ data.tar.gz: 6f42e59df9b34c140f3c6bba11010f0b6a3f7a3c45d1c7b23d5ded213ee2562e62a963b3e889a6886b97ff991e49e78af6efccf898fd951220c1cad8bcb2f66d
data/bin/todo.rb CHANGED
@@ -240,56 +240,59 @@ class Todo
240
240
  update_function.call(tasks[item])
241
241
  tasks[item][:modified] = @today.strftime(DATE_FORMAT)
242
242
  write_tasks(tasks)
243
- send(post_action, tasks) if post_action
243
+ case post_action
244
+ when :show then show(item, tasks)
245
+ when :list then list(tasks)
246
+ end
244
247
  end
245
248
 
246
249
  def append(item, text = '')
247
- update_task item, :list, lambda { |task|
250
+ update_task(item, :list, lambda do |task|
248
251
  task[:title] = [task[:title], text].join(' ')
249
252
  postprocess_tags(task)
250
- }
253
+ end)
251
254
  end
252
255
 
253
256
  def rename(item, text)
254
- update_task item, :list, lambda { |task|
257
+ update_task(item, :list, lambda do |task|
255
258
  task[:title] = text
256
259
  postprocess_tags(task)
257
- }
260
+ end)
258
261
  end
259
262
 
260
263
  def delete(item)
261
264
  tasks = load_tasks(item)
262
265
  tasks.delete(item)
263
266
  write_tasks(tasks)
264
- list(tasks)
267
+ list
265
268
  end
266
269
 
267
270
  def change_state(item, state, note = nil)
268
- update_task item, :list, lambda { |task|
271
+ update_task(item, :list, lambda do |task|
269
272
  task[:state] = state
270
273
  if !note.nil? && !note.empty?
271
274
  task[:note] ||= []
272
275
  task[:note].push(note)
273
276
  end
274
- }
277
+ end)
275
278
  end
276
279
 
277
280
  def set_priority(item, note = nil)
278
- update_task item, :list, lambda { |task|
281
+ update_task(item, :list, lambda do |task|
279
282
  task[:priority] = !task[:priority]
280
283
  task.delete(:priority) if !task[:priority]
281
284
  if !note.nil? && !note.empty?
282
285
  task[:note] ||= []
283
286
  task[:note].push(note)
284
287
  end
285
- }
288
+ end)
286
289
  end
287
290
 
288
291
  def due_date(item, date = '')
289
- update_task item, :list, lambda { |task|
292
+ update_task(item, :list, lambda do |task|
290
293
  task[:due] = convert_due_date(date)
291
294
  task.delete(:due) if task[:due].nil?
292
- }
295
+ end)
293
296
  end
294
297
 
295
298
  def list(tasks = nil, patterns = nil)
@@ -326,16 +329,16 @@ class Todo
326
329
  end
327
330
 
328
331
  def add_note(item, text)
329
- update_task item, :show, lambda { |task|
332
+ update_task(item, :show, lambda do |task|
330
333
  task[:note] ||= []
331
334
  task[:note].push(text)
332
- }
335
+ end)
333
336
  end
334
337
 
335
338
  def delete_note(item)
336
- update_task item, :show, lambda { |task|
339
+ update_task(item, :show, lambda do |task|
337
340
  task.delete(:note)
338
- }
341
+ end)
339
342
  end
340
343
 
341
344
  def show(item, tasks = nil)
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.25
4
+ version: 0.1.28
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-08 00:00:00.000000000 Z
11
+ date: 2021-03-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: