Skip to content

Commit

Permalink
Add reset command, changed order
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbata committed Oct 4, 2020
1 parent 1963aea commit 9f94d7f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Commands:
* start <tasknumber> mark task as started
* done <tasknumber> mark task as completed
* block <tasknumber> mark task as blocked
* reset <tasknumber> reset task to new state
* prio <tasknumber> toggle high priority flag
* due <tasknumber> <date> set due date
Expand Down
5 changes: 4 additions & 1 deletion bin/todo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def usage
* start <tasknumber> mark task as started
* done <tasknumber> mark task as completed
* block <tasknumber> mark task as blocked
* reset <tasknumber> reset task to new state
* prio <tasknumber> toggle high priority flag
* due <tasknumber> <date> set due date
Expand Down Expand Up @@ -213,7 +214,7 @@ def list(tasks = nil, patterns = nil)
items[num] = task if match
end
items = items.sort_by do |num, task|
[task[:priority] ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num]
[task[:priority] && task[:state] != 'done' ? 0 : 1, ORDER[task[:state] || 'default'], task[:due] || 'n/a', num]
end
items.each do |num, task|
state = task[:state] || 'default'
Expand Down Expand Up @@ -293,6 +294,8 @@ def read(arguments)
args.length == 1 ? change_state(args.first.to_i, 'done') : list(nil, [':done'])
when 'block'
args.length == 1 ? change_state(args.first.to_i, 'blocked') : list(nil, [':blocked'])
when 'reset'
args.length == 1 ? change_state(args.first.to_i, 'new') : list(nil, [':new'])
when 'prio'
set_priority(args.first.to_i) if args.length == 1
when 'due'
Expand Down
4 changes: 2 additions & 2 deletions todo.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'todo-jsonl'
s.version = '0.1.5'
s.date = '2020-10-02'
s.version = '0.1.6'
s.date = '2020-10-04'
s.summary = 'todo list manager inspired by todo.txt using the jsonl format'
s.authors = ['Gabor Bata']
s.homepage = 'https://github.com/gaborbata/todo'
Expand Down

0 comments on commit 9f94d7f

Please sign in to comment.