From ad999c40ddf23148de4dc96c4458ed27b1d57100 Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Thu, 25 Apr 2013 22:28:18 +1000 Subject: [PATCH 1/2] Fix typo in toplevel_binding invocation --- lib/pry/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb index 66ae3e3e..456ccd7e 100644 --- a/lib/pry/cli.rb +++ b/lib/pry/cli.rb @@ -200,7 +200,7 @@ 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"] From b1a5adfbb3eb1f3f4541560a423d93b357979d61 Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Thu, 25 Apr 2013 22:29:26 +1000 Subject: [PATCH 2/2] Send pry into interactive mode after running with -i --- lib/pry/cli.rb | 7 +++++++ lib/pry/config.rb | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb index 456ccd7e..781c2dbe 100644 --- a/lib/pry/cli.rb +++ b/lib/pry/cli.rb @@ -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 @@ -206,6 +210,9 @@ end.process_options do |opts| 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 diff --git a/lib/pry/config.rb b/lib/pry/config.rb index 71c877be..e21a2577 100644 --- a/lib/pry/config.rb +++ b/lib/pry/config.rb @@ -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