1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Don't output whereami at all unless there is code. Fixes binding.pry on (main).

This commit is contained in:
Jordon Bedwell 2012-04-01 03:02:37 -05:00
parent 07095ceccd
commit 053d91051a

View file

@ -22,11 +22,13 @@ class Pry
method = Pry::Method.from_binding(target)
method_description = method ? " in #{method.name_with_owner}" : ""
output.puts "\n#{text.bold('From:')} #{file} @ line #{line_num}#{method_description}:\n\n"
code = Pry::Code.from_file(file).around(line_num, i_num)
output.puts code.with_line_numbers.with_marker(line_num)
output.puts
if !code.empty?
output.puts "\n#{text.bold('From:')} #{file} @ line #{line_num}#{method_description}:\n\n"
output.puts code.with_line_numbers.with_marker(line_num)
output.puts
end
end
create_command "pry-backtrace", "Show the backtrace for the Pry session." do