Skip to content

Commit

Permalink
Fix bug in duplicate feature where YAML would store reference to dupl…
Browse files Browse the repository at this point in the history
…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
langhorst committed May 5, 2011
1 parent cb57e24 commit 9670107
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bin/pomo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 9670107

@benatkin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.