mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Merge pull request #912 from richo/features/interactive_exit
Features/interactive exit
This commit is contained in:
commit
4a67972968
2 changed files with 12 additions and 1 deletions
|
@ -143,6 +143,10 @@ Copyright (c) 2013 John Mair (banisterfiend)
|
|||
Pry.plugins[plugin_name].disable!
|
||||
end
|
||||
|
||||
on :i, "interactive", "Go interactive after execution" do
|
||||
Pry.config.exit_interactive = true
|
||||
end
|
||||
|
||||
on "no-plugins", "Suppress loading of plugins." do
|
||||
Pry.config.should_load_plugins = false
|
||||
end
|
||||
|
@ -200,12 +204,15 @@ end.process_options do |opts|
|
|||
Pry.initial_session_setup
|
||||
context = Pry.binding_for(eval(opts[:context]))
|
||||
else
|
||||
context = Pry.top_level_binding
|
||||
context = Pry.toplevel_binding
|
||||
end
|
||||
|
||||
if Pry::CLI.input_args.any? && Pry::CLI.input_args != ["pry"]
|
||||
full_name = File.expand_path(Pry::CLI.input_args.first)
|
||||
Pry.load_file_through_repl(full_name)
|
||||
if Pry.config.exit_interactive
|
||||
Pry.toplevel_binding.pry
|
||||
end
|
||||
exit
|
||||
end
|
||||
|
||||
|
|
|
@ -69,6 +69,10 @@ class Pry
|
|||
# Pry.config.exception_whitelist = [SystemExit, SignalException]
|
||||
attr_accessor :exception_whitelist
|
||||
|
||||
# Send Pry into interactive mode after finishing execution
|
||||
# @return [Boolean]
|
||||
attr_accessor :exit_interactive
|
||||
|
||||
# @return [Fixnum] The number of lines of context to show before and after
|
||||
# exceptions, etc.
|
||||
# @example
|
||||
|
|
Loading…
Reference in a new issue