# Prevent Ctrl+C for exiting
CMDS = [ 'help', 'rubyfu', 'ls', 'exit' ].sort
when Readline.line_buffer =~ /help.*/i
puts "Available commands:\n" + "#{CMDS.join("\t")}"
when Readline.line_buffer =~ /rubyfu.*/i
puts "Rubyfu, where Ruby goes evil!"
when Readline.line_buffer =~ /ls.*/i
when Readline.line_buffer =~ /exit.*/i
CMDS.grep( /^#{Regexp.escape(str)}/i ) unless str.nil?
Readline.completion_proc = completion # Set completion process
Readline.completion_append_character = ' ' # Make sure to add a space after completion
while line = Readline.readline('-> ', true) # Start console with character -> and make add_hist = true
break if line =~ /^quit.*/i or line =~ /^exit.*/i