todo-jsonl 1.0.4 → 1.0.5

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 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc4e0e129e6dae5b09b233027e88344b5439b805a732a97c9162ea0cd57159d4
4
- data.tar.gz: 3d521e8f11ccc2295bc32bc7bfdea49aca23c7b55023b19b8d90a8a0f002229a
3
+ metadata.gz: 2b0c251bf65b4b67f7e2650f10b6e898047a8dc1b5fcd89f1ebc364b27334f07
4
+ data.tar.gz: 86d3647f960571d3a7b5c9f33c55352a2852c6c193696eee090aeb93854009f8
5
5
  SHA512:
6
- metadata.gz: 75b546efb040d46254728b62a5d27962d9a96495a1c0295bc334580ac88beeaeb611359e04e881baa846de199684486850f96390b8efff2445e506375eab0bc0
7
- data.tar.gz: c6115760b9b524d8624ccd8491119b289a5def26910c07b1cf5d295c91ad84e07a3dbb71ae6dc44dfa7fc838a666cac67dd922aa954b1660cb1a93a79611b7ab
6
+ metadata.gz: 1e6a0153c341b7e2f7593cc2cd651e26493ea885718392d237f609c3f7b4035d538a2db20b5ba89b56639d14fafb06e7d225bcb417edf5fd5918e26574122174
7
+ data.tar.gz: 47daf98ef96b84241eeca49cbecd2ff33a4ad53663fdcbfaeba1377cabfb504b1273c71a90a462396bcec74e44f2deb4e2f37490bc1ae1a559e889f615946b61
data/bin/todo.rb CHANGED
@@ -324,7 +324,7 @@ class Todo
324
324
  end
325
325
  due_date = ' ' + due_date
326
326
  end
327
- puts "#{num.to_s.rjust(task_indent, ' ')}:#{priority_flag}#{display_state} #{title}#{due_date}"
327
+ puts "#{num.to_s.rjust(task_indent)}:#{priority_flag}#{display_state} #{title}#{due_date}"
328
328
  end
329
329
  puts 'No todos found' if items.empty?
330
330
  end
@@ -338,19 +338,23 @@ class Todo
338
338
 
339
339
  def delete_note(item, num = nil)
340
340
  update_task(item, :show, lambda do |task|
341
- return task.delete(:note) if num.to_s.empty?
342
- raise "#{num.to_i}: Note does not exist" if num.to_i <= 0 || task[:note].to_a.size < num.to_i
343
- task[:note].delete_at(num.to_i - 1)
344
- task.delete(:note) if task[:note].empty?
341
+ if num.to_s.empty?
342
+ task.delete(:note)
343
+ else
344
+ raise "#{num.to_i}: Note does not exist" if num.to_i <= 0 || task[:note].to_a.size < num.to_i
345
+ task[:note].delete_at(num.to_i - 1)
346
+ task.delete(:note) if task[:note].empty?
347
+ end
345
348
  end)
346
349
  end
347
350
 
348
351
  def show(item, tasks = nil)
349
352
  tasks ||= load_tasks(item)
350
353
  tasks[item].each do |k, v|
351
- v = "\n" + v.each_with_index.map { |n, i| "#{(i + 1).to_s.rjust(v.size.to_s.size, ' ')}: #{n}" }.
354
+ v = "\n" + v.each_with_index.
355
+ map { |n, i| v.size > 1 ? "#{(i + 1).to_s.rjust(v.size.to_s.size)}: #{n}" : n }.
352
356
  join("\n") if v.is_a?(Array)
353
- puts "#{colorize(k.to_s.rjust(10, ' ') + ':', :cyan)} #{v}"
357
+ puts "#{colorize(k.to_s.rjust(10) + ':', :cyan)} #{v}"
354
358
  end
355
359
  end
356
360
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todo-jsonl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabor Bata