Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Justin Langhorst authored May 04, 2011

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. 11  bin/pomo
11  bin/pomo
@@ -257,10 +257,15 @@ command :duplicate do |c|
257 257
   c.description = 'Duplicate a task, adding the duplicated task to the end of the list'
258 258
   c.example 'Duplicate the first task', 'pomo duplicate first'
259 259
   c.example 'Duplicate task 4', 'pomo duplicate 4'
260  
-  c.action do |args|
  260
+  c.example 'Duplicate the last task 5 times', 'pomo duplicate last -n 5'
  261
+  c.option '-n', '--number times', Integer, 'Duplicate a number times'
  262
+  c.action do |args, options|
  263
+    options.default :number => 1
261 264
     list.find(args[0]) do |task, i|
262  
-      list.add(task) 
263  
-      say "  - duplicated #{task}"
  265
+      options.number.times do
  266
+        list.add(task.dup) 
  267
+        say "  - duplicated #{task}"
  268
+      end
264 269
     end
265 270
     list.save
266 271
   end

1 note on commit 9670107

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