From: <th...@us...> - 2011-01-25 22:16:40
|
Revision: 260 http://etch.svn.sourceforge.net/etch/?rev=260&view=rev Author: thepob Date: 2011-01-25 22:16:34 +0000 (Tue, 25 Jan 2011) Log Message: ----------- completing ticket #12 - allowing interactive mode to default to the previously used selection Modified Paths: -------------- trunk/client/etchclient.rb Modified: trunk/client/etchclient.rb =================================================================== --- trunk/client/etchclient.rb 2011-01-20 19:42:05 UTC (rev 259) +++ trunk/client/etchclient.rb 2011-01-25 22:16:34 UTC (rev 260) @@ -2292,13 +2292,25 @@ def get_user_confirmation while true - print "Proceed/Skip/Quit? [p|s|q] " - response = $stdin.gets.chomp - if response == 'p' + print "Proceed/Skip/Quit? " + if instance_variable_defined?("@response") + case @response + when /p|P/ then print "[P|s|q] " + when /s|S/ then print "[p|S|q] " + when /q|Q/ then print "[p|s|Q] " + end + else + print "[p|s|q] " + end + response = $stdin.gets.chomp + if response =~ /p/i || (instance_variable_defined?("@response") && @response =~ /p/i) + @response = response if !response.strip.empty? return CONFIRM_PROCEED - elsif response == 's' + elsif response =~ /s/i || (instance_variable_defined?("@response") && @response =~ /s/i) + @response = response if !response.strip.empty? return CONFIRM_SKIP - elsif response == 'q' + elsif response =~ /q/i || (instance_variable_defined?("@response") && @response =~ /q/i) + @response = response if !response.strip.empty? return CONFIRM_QUIT end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |