todo-jsonl 0.1.15 → 0.1.16

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 +12 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eac1c59e2d905a14881aae2903048c63b0b3ff796a1d8511cff286e0d64052fa
4
- data.tar.gz: b7105e1b10437375614ea5f696533613100a81eaa57cc11590a1248b2f1ad082
3
+ metadata.gz: 6d359c12e487b44bf92a6406c044944c6aac14f4e1e45850b021c7184feb274d
4
+ data.tar.gz: 84b3b6d64e208e96cb81afbad8f6b07ca2f685a13178854fbd7792c5fde9062a
5
5
  SHA512:
6
- metadata.gz: ef12c1dd2fd26e691a68b8e7934e431cc3cca2eb6542c03671481ecfdbcc29515b133b9db45d103e7cf554da9b12be20139463254192fb55a8fb381fc97345fc
7
- data.tar.gz: bcabeafc8735514c3b4f4f19e2c70a970588b7bff168f1f1e928a1b06a79726527cb9df4d3a7250648d256de9749290b70a712bb19f01479481531884536570a
6
+ metadata.gz: 2eb6fb53e9ab1abd698a55995f7497de9e26f65787402d79afaaf62ca3c58a84cd79d363167d3001e02df0c0eb9a7e024fdd7be37c19d159833041686d6c85fc
7
+ data.tar.gz: 0edda1d28b4f76aa17bbf0b6c44e11025d433022bb9fef6d1ef1671de360ba841c77dd0c47400afe9f372a0a38c3c13b1a8b85a39de813e7c68fcd146b40ce5f
data/bin/todo.rb CHANGED
@@ -98,7 +98,7 @@ def usage
98
98
  * done <tasknumber> [text] mark task as completed, with optional note
99
99
  * block <tasknumber> [text] mark task as blocked, with optional note
100
100
  * reset <tasknumber> [text] reset task to new state, with optional note
101
- * prio <tasknumber> toggle high priority flag
101
+ * prio <tasknumber> [text] toggle high priority flag, with optional note
102
102
  * due <tasknumber> [date] set/unset due date (in YYYY-MM-DD format)
103
103
 
104
104
  * append <tasknumber> <text> append text to task title
@@ -209,10 +209,14 @@ def change_state(item, state, note = nil)
209
209
  list(tasks)
210
210
  end
211
211
 
212
- def set_priority(item)
212
+ def set_priority(item, note = nil)
213
213
  tasks = load_tasks(item)
214
214
  tasks[item][:priority] = !tasks[item][:priority]
215
215
  tasks[item][:modified] = Time.now.strftime(DATE_FORMAT)
216
+ if !note.nil? && !note.empty?
217
+ tasks[item][:note] ||= []
218
+ tasks[item][:note].push(note)
219
+ end
216
220
  write_tasks(tasks)
217
221
  list(tasks)
218
222
  end
@@ -330,16 +334,16 @@ def read(arguments)
330
334
  raise action + ' command requires at least one parameter' if args.nil? || args.empty?
331
335
  add(args.join(' '))
332
336
  when 'start'
333
- args.length > 0 ? change_state(args.first.to_i, 'started', args[1..-1].join(' ')) : list(nil, [':started'])
337
+ args.length > 0 ? change_state(args.first.to_i, 'started', (args[1..-1] || []).join(' ')) : list(nil, [':started'])
334
338
  when 'done'
335
- args.length > 0 ? change_state(args.first.to_i, 'done', args[1..-1].join(' ')) : list(nil, [':done'])
339
+ args.length > 0 ? change_state(args.first.to_i, 'done', (args[1..-1] || []).join(' ')) : list(nil, [':done'])
336
340
  when 'block'
337
- args.length > 0 ? change_state(args.first.to_i, 'blocked', args[1..-1].join(' ')) : list(nil, [':blocked'])
341
+ args.length > 0 ? change_state(args.first.to_i, 'blocked', (args[1..-1] || []).join(' ')) : list(nil, [':blocked'])
338
342
  when 'reset'
339
- args.length > 0 ? change_state(args.first.to_i, 'new', args[1..-1].join(' ')) : list(nil, [':new'])
343
+ args.length > 0 ? change_state(args.first.to_i, 'new', (args[1..-1] || []).join(' ')) : list(nil, [':new'])
340
344
  when 'prio'
341
- raise action + ' command requires exactly one parameter' if args.length != 1
342
- set_priority(args.first.to_i)
345
+ raise action + ' command requires at least one parameter' if args.length < 1
346
+ set_priority(args.first.to_i, (args[1..-1] || []).join(' '))
343
347
  when 'due'
344
348
  raise action + ' command requires at least one parameter' if args.length < 1
345
349
  due_date(args.first.to_i, (args[1..-1] || []).join(' '))
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.15
4
+ version: 0.1.16
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-02-25 00:00:00.000000000 Z
11
+ date: 2021-02-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: