Sha256: e2c10812619b1a49745aed21555e7e282103ea4f8b463a7d3c1681af6762cca2

Contents?: true

Size: 779 Bytes

Versions: 55

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

# @@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

  c.desc 'Select from an interactive menu'
  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?

    if options[:interactive]
      Doing::Util::Backup.select_redo(file)
    else
      Doing::Util::Backup.redo_backup(file, count: count)
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
doing-2.1.88 bin/commands/redo.rb
doing-2.1.87 bin/commands/redo.rb
doing-2.1.86 bin/commands/redo.rb
doing-2.1.85 bin/commands/redo.rb
doing-2.1.84 bin/commands/redo.rb
doing-2.1.83 bin/commands/redo.rb
doing-2.1.82 bin/commands/redo.rb
doing-2.1.81 bin/commands/redo.rb
doing-2.1.80 bin/commands/redo.rb
doing-2.1.79 bin/commands/redo.rb
doing-2.1.78 bin/commands/redo.rb
doing-2.1.77 bin/commands/redo.rb
doing-2.1.76 bin/commands/redo.rb
doing-2.1.75 bin/commands/redo.rb
doing-2.1.74 bin/commands/redo.rb
doing-2.1.73 bin/commands/redo.rb
doing-2.1.72 bin/commands/redo.rb
doing-2.1.69 bin/commands/redo.rb
doing-2.1.68 bin/commands/redo.rb
doing-2.1.66 bin/commands/redo.rb