2012-08-11 17:22:29 -07:00
|
|
|
class Pry
|
2012-12-25 23:35:17 +02:00
|
|
|
class Command::ExitAll < Pry::ClassCommand
|
|
|
|
match 'exit-all'
|
2012-08-11 18:26:59 -07:00
|
|
|
group 'Navigating Pry'
|
2012-12-25 23:35:17 +02:00
|
|
|
description 'End the current Pry session (popping all bindings) and ' \
|
|
|
|
'returning to caller. Accepts optional return value. Aliases: !!@'
|
2012-08-11 17:22:29 -07:00
|
|
|
|
2012-08-11 18:26:59 -07:00
|
|
|
def process
|
|
|
|
# calculate user-given value
|
|
|
|
exit_value = target.eval(arg_string)
|
2012-08-11 17:22:29 -07:00
|
|
|
|
2012-08-11 18:26:59 -07:00
|
|
|
# clear the binding stack
|
|
|
|
_pry_.binding_stack.clear
|
|
|
|
|
|
|
|
# break out of the repl loop
|
|
|
|
throw(:breakout, exit_value)
|
|
|
|
end
|
2012-08-11 17:22:29 -07:00
|
|
|
end
|
|
|
|
|
2012-12-25 23:35:17 +02:00
|
|
|
Pry::Commands.add_command(Pry::Command::ExitAll)
|
|
|
|
Pry::Commands.alias_command '!!@', 'exit-all'
|
2012-08-11 17:22:29 -07:00
|
|
|
end
|