lib/git_commands/prompt.rb in git_commands-3.0.4 vs lib/git_commands/prompt.rb in git_commands-3.0.5
- old
+ new
@@ -3,12 +3,10 @@
module GitCommands
using Colorize
module Prompt
VALID_ANSWERS = %w[Y y N n]
- class AbortError < StandardError; end
-
def out
@out ||= STDOUT
end
def warning(message, char = "*")
@@ -32,18 +30,23 @@
end until VALID_ANSWERS.include?(res)
case res
when /y/i
yield
else
- error("Aborted operation!", AbortError)
+ abort!("Aborted operation!")
end
end
private
def ask(message)
out.print message.cyan
input
+ end
+
+ def abort!(message)
+ out.puts message.to_s.red
+ exit
end
def input
STDIN.gets.chomp
end