2012-08-11 20:22:29 -04:00
|
|
|
class Pry
|
2012-12-25 16:35:17 -05:00
|
|
|
class Command::PryBacktrace < Pry::ClassCommand
|
|
|
|
match 'pry-backtrace'
|
2012-08-11 21:26:59 -04:00
|
|
|
group 'Context'
|
2012-12-25 16:35:17 -05:00
|
|
|
description 'Show the backtrace for the Pry session.'
|
2012-08-11 21:26:59 -04:00
|
|
|
|
2012-08-11 20:22:29 -04:00
|
|
|
banner <<-BANNER
|
2013-01-09 15:23:19 -05:00
|
|
|
Usage: pry-backtrace [OPTIONS] [--help]
|
2012-08-11 20:22:29 -04:00
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
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.
|
2012-08-11 20:22:29 -04:00
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
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
|
2012-08-11 20:22:29 -04:00
|
|
|
BANNER
|
|
|
|
|
|
|
|
def process
|
2012-12-27 22:53:16 -05:00
|
|
|
stagger_output text.bold('Backtrace:') +
|
|
|
|
"\n--\n" + _pry_.backtrace.join("\n")
|
2012-08-11 20:22:29 -04:00
|
|
|
end
|
|
|
|
end
|
2012-12-25 16:35:17 -05:00
|
|
|
|
|
|
|
Pry::Commands.add_command(Pry::Command::PryBacktrace)
|
2012-08-11 20:22:29 -04:00
|
|
|
end
|