def self.load_history
filename = File.expand_path(config.plugins.history.filename)
keys = config.plugins.history.keys
if File.exist?(filename)
begin
history = Marshal.load Zlib::Inflate.inflate(File.read(filename))
rescue Zlib::BufError => e
ui = create_highline
delete = ui.ask("Unable to read #{filename}. Do you wish to remove it?")
if delete =~ /^y/i
if File.delete(filename) > 1
puts "Removed #{filename}"
end
end
history = nil
end
if history
keys.each do |key|
public_storage[key] = history[key] if history[key]
end
Readline::HISTORY.push *history[:history] if history[:history]
puts "history loaded(#{File.size(filename)/1000}kb)"
end
end
end