diff options
author | Simon Parri <simonparri@ganzeria.com> | 2020-03-30 13:43:34 -0500 |
---|---|---|
committer | Simon Parri <simonparri@ganzeria.com> | 2020-03-30 13:43:34 -0500 |
commit | 0686901f6e1edd872a2a1b3562031ab4f0eccfb7 (patch) | |
tree | e0471caa78a9a340f6d52da129d1bfe8ba07f49c | |
parent | 8bade080be64b96ee8b47870dc7a7731c72731e8 (diff) | |
download | spelling-rbee-0686901f6e1edd872a2a1b3562031ab4f0eccfb7.tar.gz spelling-rbee-0686901f6e1edd872a2a1b3562031ab4f0eccfb7.zip |
switch to readline
-rwxr-xr-x | spelling-rbee | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spelling-rbee b/spelling-rbee index cbd30d2..bff49a6 100755 --- a/spelling-rbee +++ b/spelling-rbee @@ -1,6 +1,11 @@ #!/usr/bin/ruby require "open-uri" +require "readline" + +def get(prompt="spell: ") + Readline.readline prompt +end def say(it,speed=100) system "espeak -s #{speed} '#{it}'" @@ -31,16 +36,14 @@ end def repl(words) correct = [] words.each {|word| - print "spell: " say word - result = $stdin.gets.chomp! + result = get until result[0] != ":" ckopt(word,result) if $exit return $exit end - print "spell: " - result = $stdin.gets.chomp! + result = get end correct.push ckword(word,result) } |