Class: Restore

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

Overview

Command ‘lookfile restore’ implementation

Class Method Summary collapse

Methods inherited from Command

childrens, childrens?, run_childrens, usage, usage_bottom, usage_header

Class Method Details

.command_nameObject



14
15
16
# File 'lib/commands/restore.rb', line 14

def self.command_name
  'restore'
end

.options_messagesObject



8
9
10
11
12
# File 'lib/commands/restore.rb', line 8

def self.options_messages
  %(  restore \t $ lookfile restore
\t\t - Restore files from lookfile to user pc
  )
end

.parentObject



18
19
20
# File 'lib/commands/restore.rb', line 18

def self.parent
  Look
end

.runObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/commands/restore.rb', line 22

def self.run(*)
  files_path = []
  Lookfile.list_files.each do |file_path|
    print "Restore file #{file_path} (Y/n): "
    option = $stdin.gets.chomp.upcase
    option = 'Y' if option.empty?
    files_path << file_path if option == 'Y'
  end
  puts Lookfile.restore(files_path)
end