bin/commands/redo.rb in doing-2.1.26 vs bin/commands/redo.rb in doing-2.1.27
- old
+ new
@@ -1,7 +1,10 @@
+# frozen_string_literal: true
+
# @@redo
-long_desc 'Shortcut for `doing undo -r`, reverses the last undo command. You cannot undo a redo'
+desc 'Redo an undo command'
+long_desc 'Shortcut for `doing undo -r`, reverses the last undo command. Specify a count to redo multiple undos'
arg_name 'COUNT'
command :redo do |c|
c.desc 'Specify alternate doing file'
c.arg_name 'PATH'
c.flag %i[f file], default_value: @wwid.doing_file
@@ -10,10 +13,11 @@
c.switch %i[i interactive]
c.action do |_global, options, args|
file = options[:file] || @wwid.doing_file
count = args.empty? ? 1 : args[0].to_i
- raise InvalidArgument, "Invalid count specified for redo" unless count&.positive?
+ raise InvalidArgument, 'Invalid count specified for redo' unless count&.positive?
+
if options[:interactive]
Doing::Util::Backup.select_redo(file)
else
Doing::Util::Backup.redo_backup(file, count: count)
end