debrew: take input from same line as prompt

This commit is contained in:
Jack Nagel 2012-11-09 15:18:01 -06:00
parent bba85b4bd9
commit 8d7be8c0b4

View File

@ -26,7 +26,7 @@ def choose
menu.entries.each_with_index do |entry, i| menu.entries.each_with_index do |entry, i|
puts "#{i+1}. #{entry[:name]}" puts "#{i+1}. #{entry[:name]}"
end end
puts menu.prompt unless menu.prompt.nil? print menu.prompt unless menu.prompt.nil?
reply = $stdin.gets.chomp reply = $stdin.gets.chomp
i = reply.to_i i = reply.to_i
@ -102,7 +102,7 @@ def debrew(exception, formula=nil)
begin begin
again = false again = false
choose do |menu| choose do |menu|
menu.prompt = "Choose an action:" menu.prompt = "Choose an action: "
menu.choice(:raise) { original_raise exception } menu.choice(:raise) { original_raise exception }
menu.choice(:ignore) { exception.restart } menu.choice(:ignore) { exception.restart }
menu.choice(:backtrace) { puts exception.backtrace; again = true } menu.choice(:backtrace) { puts exception.backtrace; again = true }