Sha256: e978c4583aeb41ee5c70d6615b867a29e90c5fa78a539fb68600c585918c4b27
Contents?: true
Size: 932 Bytes
Versions: 1
Compression:
Stored size: 932 Bytes
Contents
require 'rib/more/multiline_history' module Rib::MultilineHistoryFile include Rib::Plugin Shell.use(self) def before_loop return super if MultilineHistoryFile.disabled? config[:multiline_history_file_token] ||= ' ' super end def read_history return super if MultilineHistoryFile.disabled? buffer = [] File.exist?(history_file) && history.empty? && IO.readlines(history_file).each{ |line| if line.end_with?( "#{config[:multiline_history_file_token]}\n") buffer << line[0... -config[:multiline_history_file_token].size-1] + "\n" else history << (buffer.join + line).chomp buffer = [] end } end def write_history return super if MultilineHistoryFile.disabled? @history = history.to_a.map{ |line| line.gsub("\n", "#{config[:multiline_history_file_token]}\n") } super end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rib-0.1.0 | lib/rib/more/multiline_history_file.rb |