diff options
-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) } |