blob: 1136de318a079e0c1df361a7f0eb3ce7293ef5c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
class Pry
class Command::ExitAll < Pry::ClassCommand
match 'exit-all'
group 'Navigating Pry'
description 'End the current Pry session.'
banner <<-'BANNER'
Usage: exit-all [--help]
Aliases: !!@
End the current Pry session (popping all bindings and returning to caller).
Accepts optional return value.
BANNER
def process
# calculate user-given value
exit_value = target.eval(arg_string)
# clear the binding stack
_pry_.binding_stack.clear
# break out of the repl loop
throw(:breakout, exit_value)
end
end
Pry::Commands.add_command(Pry::Command::ExitAll)
Pry::Commands.alias_command '!!@', 'exit-all'
end
|