blob: 63c55718e730715bc95b0cf8b55311156737dd15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
require "readline"
$history_loaded = false
$histfile = "#{ENV['HOME']}/.mal-history"
def _readline(prompt)
if not $history_loaded
$history_loaded = true
File.readlines($histfile).each {|l| Readline::HISTORY.push(l.chomp)}
end
if line = Readline.readline(prompt, true)
File.open($histfile, 'a+') {|f| f.write(line+"\n")}
return line
else
return nil
end
end
|