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:
parent
07095ceccd
commit
053d91051a
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue