Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix bug in duplicate feature where YAML would store reference to dupl…

…icated task instead of actually duplicating task (caused problems when removing, would remove both original and duplicated tasks). Add ability to duplicate a task multiple times with option -n (--number)
  • Loading branch information...
commit 96701074fdbec4145e8fde602c43596f7250e7bc 1 parent cb57e24
@langhorst authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 bin/pomo
View
11 bin/pomo
@@ -257,10 +257,15 @@ command :duplicate do |c|
c.description = 'Duplicate a task, adding the duplicated task to the end of the list'
c.example 'Duplicate the first task', 'pomo duplicate first'
c.example 'Duplicate task 4', 'pomo duplicate 4'
- c.action do |args|
+ c.example 'Duplicate the last task 5 times', 'pomo duplicate last -n 5'
+ c.option '-n', '--number times', Integer, 'Duplicate a number times'
+ c.action do |args, options|
+ options.default :number => 1
list.find(args[0]) do |task, i|
- list.add(task)
- say " - duplicated #{task}"
+ options.number.times do
+ list.add(task.dup)
+ say " - duplicated #{task}"
+ end
end
list.save
end

1 comment on commit 9670107

Please sign in to comment.
Something went wrong with that request. Please try again.