Closed lsribeiro closed 7 years ago
Hi @lsribeiro - Thank you for implementing this! It's on hold because I had an idea about an alternative feature using the arrow keys. I will do a code review and let you know what I think when I have some time. For now, I noticed that you will need to print a newline after the input is received (as it used to do).
Thanks @lsribeiro! Merged!
Requested in #66. Since it is on hold, I'm not sure if I should have implemented it, but I did it anyway. I just had to replace the input method from
gets.chomp
toReadline
. (https://ruby-doc.org/stdlib-2.1.0/libdoc/readline/rdoc/Readline.html). The reason I choseReadline
, it's because it already provides a history feature, including scrolling up and down with the arrow keys. Unfortunatelly, it doesn't work well with RSpec, so, I had to reusegets
in the test enviroment. I coded so the history would ignore single character commands, since it is faster to type them out, rather than search for them in the history. It also ignores repeated commands typed consecutively.