In Python, we can use import readline to make raw_input() accept UP key to show input history.
Is there any way to do the same thing in Ruby?
You can use Ruby's readline library, like so.
require "readline"
while buf = Readline.readline("> ", true)
p buf
end
Readline Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With