class Object
Public Instance Methods
confirm(title)
click to toggle source
# File exe/pr, line 15 def confirm(title) printf "#{title}\npress 'y' to continue: " prompt = STDIN.gets.chomp prompt == 'y' end
current_branch()
click to toggle source
# File exe/pr, line 34 def current_branch sh_get "git rev-parse --abbrev-ref HEAD" end
error(title)
click to toggle source
# File exe/pr, line 10 def error(title) STDERR.puts title exit 1 end
sh(command)
click to toggle source
# File exe/pr, line 21 def sh(command) return puts "▶️ #{command}" if @simulate error "could not execute '#{command}'" unless system(command) end
sh_get(command)
click to toggle source
# File exe/pr, line 27 def sh_get(command) value = `#{command}` error "could not execute '#{command}'" unless $? == 0 value.strip end