Skip to content
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...
1 parent cb57e24 commit 96701074fdbec4145e8fde602c43596f7250e7bc @langhorst committed
Showing with 8 additions and 3 deletions.
  1. +8 −3 bin/pomo
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

1 comment on commit 9670107

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