Skip to content

Commit

Permalink
Ruby: Escape our completion options.
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebrock committed Dec 21, 2016
1 parent b9d4d6c commit 00358bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
Readline.completer_quote_characters = "\"'" Readline.completer_quote_characters = "\"'"


Readline.completion_proc = proc do |input| Readline.completion_proc = proc do |input|
CHARACTER_NAMES.select { |name| name.start_with?(input) } options = CHARACTER_NAMES
if Readline.completion_quote_character.nil?
options = options.map { |o| o.gsub(" ", "\\ ") }
end

options.select { |name| name.start_with?(input) }
end end


puts "Who's your favourite Hitchiker's Guide character?" puts "Who's your favourite Hitchiker's Guide character?"
Expand Down

0 comments on commit 00358bd

Please sign in to comment.