Class: Awshucks::RestoreCommand

Inherits:
Command show all
Defined in:
lib/awshucks/commands/restore.rb

Instance Method Summary collapse

Methods inherited from Command

commands, execute, inherited, #option_parser, option_string, parse_and_execute

Instance Method Details

#execute(args, config) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/awshucks/commands/restore.rb', line 12

def execute(args, config)
  @config = config
  
  if args.empty?
    $stderr.puts "Please specify a backup configuration to restore from"
  else
    backup = config.backup(args[0])
    pattern = args[1] || '*'
    target_dir = args[2] || backup.location
    restore(backup, pattern, target_dir)
  end

rescue UnknownBackupError
  $stderr.puts "Unknown backup: #{args.first}"
end