2012-08-12 00:22:29 +00:00
|
|
|
class Pry
|
2012-12-25 21:35:17 +00:00
|
|
|
class Command::PryBacktrace < Pry::ClassCommand
|
|
|
|
match 'pry-backtrace'
|
2012-08-12 01:26:59 +00:00
|
|
|
group 'Context'
|
2012-12-25 21:35:17 +00:00
|
|
|
description 'Show the backtrace for the Pry session.'
|
2012-08-12 01:26:59 +00:00
|
|
|
|
2012-08-12 00:22:29 +00:00
|
|
|
banner <<-BANNER
|
|
|
|
Usage: pry-backtrace [OPTIONS] [--help]
|
|
|
|
|
|
|
|
Show the backtrace for the position in the code where Pry was started. This can be used to
|
|
|
|
infer the behavior of the program immediately before it entered Pry, just like the backtrace
|
|
|
|
property of an exception.
|
|
|
|
|
|
|
|
(NOTE: if you are looking for the backtrace of the most recent exception raised,
|
|
|
|
just type: `_ex_.backtrace` instead, see https://github.com/pry/pry/wiki/Special-Locals)
|
|
|
|
|
|
|
|
e.g: pry-backtrace
|
|
|
|
BANNER
|
|
|
|
|
|
|
|
def process
|
2012-12-28 03:53:16 +00:00
|
|
|
stagger_output text.bold('Backtrace:') +
|
|
|
|
"\n--\n" + _pry_.backtrace.join("\n")
|
2012-08-12 00:22:29 +00:00
|
|
|
end
|
|
|
|
end
|
2012-12-25 21:35:17 +00:00
|
|
|
|
|
|
|
Pry::Commands.add_command(Pry::Command::PryBacktrace)
|
2012-08-12 00:22:29 +00:00
|
|
|
end
|