Skip to content
Permalink
Browse files

Ruby: Escape our completion options.

  • Loading branch information
georgebrock committed Dec 21, 2016
1 parent b9d4d6c commit 00358bd8ceb7dd26f5253911ea16b0a63eedd775
Showing with 6 additions and 1 deletion.
  1. +6 −1 main.rb
@@ -10,7 +10,12 @@
Readline.completer_quote_characters = "\"'"

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

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

0 comments on commit 00358bd

Please sign in to comment.
You can’t perform that action at this time.