lib/git_bumper/cli.rb in git_bumper-0.1.2 vs lib/git_bumper/cli.rb in git_bumper-0.1.3
- old
+ new
@@ -20,11 +20,11 @@
new_tag = old_tag.clone
new_tag.increment(@options.fetch(:increment))
puts "The old tag is #{old_tag}"
puts "The new tag will be #{new_tag}"
- puts 'Push to origin? (y/N)'
+ puts 'Push to origin? (Y/n)'
return error('Aborted.') unless prompt_yes
Git.create_tag(new_tag)
Git.push_tag(new_tag)
@@ -40,10 +40,11 @@
@error = true
@error_msg = msg
end
def prompt_yes
- STDIN.gets.chomp.to_s =~ /y(es)?/i
+ input = STDIN.gets.chomp.to_s
+ input.empty? || input =~ /\Ay(es)?\z/i
end
def greatest_tag
Git.greatest_tag(klass: @options.fetch(:klass),
prefix: @options.fetch(:prefix))