pry 0.8.4pre1 → 0.9.0pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.gitignore +1 -0
  2. data/README.markdown +1 -1
  3. data/Rakefile +11 -5
  4. data/TODO +28 -2
  5. data/bin/pry +5 -9
  6. data/examples/example_basic.rb +2 -4
  7. data/examples/example_command_override.rb +2 -5
  8. data/examples/example_commands.rb +1 -4
  9. data/examples/example_hooks.rb +2 -5
  10. data/examples/example_image_edit.rb +4 -8
  11. data/examples/example_input.rb +1 -4
  12. data/examples/example_input2.rb +1 -4
  13. data/examples/example_output.rb +1 -4
  14. data/examples/example_print.rb +2 -5
  15. data/examples/example_prompt.rb +2 -5
  16. data/examples/helper.rb +6 -0
  17. data/lib/pry.rb +61 -4
  18. data/lib/pry/command_context.rb +10 -9
  19. data/lib/pry/command_processor.rb +29 -68
  20. data/lib/pry/command_set.rb +79 -28
  21. data/lib/pry/commands.rb +10 -121
  22. data/lib/pry/completion.rb +30 -29
  23. data/lib/pry/config.rb +93 -0
  24. data/lib/pry/default_commands/basic.rb +37 -0
  25. data/lib/pry/default_commands/context.rb +15 -15
  26. data/lib/pry/default_commands/documentation.rb +49 -48
  27. data/lib/pry/default_commands/easter_eggs.rb +1 -20
  28. data/lib/pry/default_commands/gems.rb +32 -41
  29. data/lib/pry/default_commands/input.rb +95 -19
  30. data/lib/pry/default_commands/introspection.rb +54 -60
  31. data/lib/pry/default_commands/ls.rb +2 -2
  32. data/lib/pry/default_commands/shell.rb +29 -39
  33. data/lib/pry/extended_commands/experimental.rb +48 -0
  34. data/lib/pry/extended_commands/user_command_api.rb +22 -0
  35. data/lib/pry/helpers.rb +1 -0
  36. data/lib/pry/helpers/base_helpers.rb +9 -106
  37. data/lib/pry/helpers/command_helpers.rb +96 -59
  38. data/lib/pry/helpers/text.rb +83 -0
  39. data/lib/pry/plugins.rb +79 -0
  40. data/lib/pry/pry_class.rb +96 -111
  41. data/lib/pry/pry_instance.rb +87 -55
  42. data/lib/pry/version.rb +1 -1
  43. data/test/helper.rb +56 -7
  44. data/test/test_command_processor.rb +99 -0
  45. data/test/{test_commandset.rb → test_command_set.rb} +18 -12
  46. data/test/test_default_commands.rb +59 -0
  47. data/test/test_default_commands/test_context.rb +64 -0
  48. data/test/test_default_commands/test_documentation.rb +31 -0
  49. data/test/test_default_commands/test_input.rb +157 -0
  50. data/test/test_default_commands/test_introspection.rb +146 -0
  51. data/test/test_pry.rb +430 -313
  52. metadata +25 -9
  53. data/lib/pry/hooks.rb +0 -17
  54. data/lib/pry/print.rb +0 -16
  55. data/lib/pry/prompts.rb +0 -31
data/.gitignore CHANGED
@@ -2,6 +2,7 @@ Makefile
2
2
  *.so
3
3
  *.o
4
4
  *.def
5
+ *.rbc
5
6
  doc/
6
7
  pkg/
7
8
  coverage/
@@ -1,4 +1,4 @@
1
- ![Alt text](http://dl.dropbox.com/u/26521875/pry_logo_shade.png)
1
+ ![Alt text](http://dl.dropbox.com/u/15761219/pry_horizontal_red.png)
2
2
 
3
3
  (C) John Mair (banisterfiend) 2011
4
4
 
data/Rakefile CHANGED
@@ -5,7 +5,8 @@ $:.unshift 'lib'
5
5
  require 'pry/version'
6
6
 
7
7
  CLOBBER.include("**/*~", "**/*#*", "**/*.log")
8
- CLEAN.include("**/*#*", "**/*#*.*", "**/*_flymake*.*", "**/*_flymake", "**/*.rbc")
8
+ CLEAN.include("**/*#*", "**/*#*.*", "**/*_flymake*.*", "**/*_flymake",
9
+ "**/*.rbc", "**/.#*.*")
9
10
 
10
11
  def apply_spec_defaults(s)
11
12
  s.name = "pry"
@@ -16,13 +17,12 @@ def apply_spec_defaults(s)
16
17
  s.email = 'jrmair@gmail.com'
17
18
  s.description = s.summary
18
19
  s.homepage = "http://banisterfiend.wordpress.com"
19
- s.has_rdoc = 'yard'
20
20
  s.executables = ["pry"]
21
21
  s.files = `git ls-files`.split("\n")
22
22
  s.test_files = `git ls-files -- test/*`.split("\n")
23
23
  s.add_dependency("ruby_parser",">=2.0.5")
24
24
  s.add_dependency("coderay",">=0.9.8")
25
- s.add_dependency("slop",">=1.5.3")
25
+ s.add_dependency("slop","~>1.6.0")
26
26
  s.add_dependency("method_source",">=0.4.0")
27
27
  s.add_development_dependency("bacon",">=1.1.0")
28
28
  end
@@ -33,8 +33,7 @@ end
33
33
 
34
34
  desc "run pry"
35
35
  task :pry do
36
- require 'pry'
37
- binding.pry
36
+ load 'bin/pry'
38
37
  end
39
38
 
40
39
  desc "show pry version"
@@ -52,6 +51,13 @@ namespace :ruby do
52
51
  pkg.need_zip = false
53
52
  pkg.need_tar = false
54
53
  end
54
+
55
+ desc "Generate gemspec file"
56
+ task :gemspec do
57
+ File.open("#{spec.name}-#{spec.version}.gemspec", "w") do |f|
58
+ f << spec.to_ruby
59
+ end
60
+ end
55
61
  end
56
62
 
57
63
  [:mingw32, :mswin32].each do |v|
data/TODO CHANGED
@@ -1,13 +1,39 @@
1
1
 
2
+ ROADMAP
3
+
2
4
  FUTURE
3
- * allows pipes (|) for commands
5
+ --------
6
+ * Pry server and Pry client for SLIME style remote repl connectinos.
7
+ * i18n support
8
+
9
+ 0.9.0
10
+ Major features
11
+ --------------
12
+ * Restructure command system and helpers (almost complete)
13
+ * Delete unnecessary commands, add a couple of new ones (e.g amend-line)
14
+ * Readline history
15
+ * Plugin support
16
+ * Support Rubinius core methods
17
+ * in[] and out[] arrays
18
+ * Improve test coverage (test some commands, etc)
19
+
20
+ Minor changes
21
+ -------------
22
+ * improve edit-method support for various editors
23
+ * ensure all commands have appropriate error handing and informative error messages
24
+ * show-doc should include signature of method
25
+
26
+ Optional
27
+ --------
28
+ * multi-line readline support
29
+
4
30
 
5
31
  0.8.0
6
32
  * allow #{} interpolation of all commands
7
33
  * update documentation! new commands and features and change in behaviour of `run`
8
34
  * add ; at end of line to suppress return value output
9
35
  * Remove message spam (before/after hooks)
10
- * stop commands returning a value
36
+ * stop commands returning a value
11
37
  * use `redo` in the r() method when encounter a command
12
38
  * shell functionality should just use system(), but redirect in and
13
39
  out to Pry.input and Pry.output by reassining $stdin and $stdout
data/bin/pry CHANGED
@@ -22,7 +22,7 @@ See: `https://github.com/banister` for more information.
22
22
  on :e, :exec, "A line of code to execute in context before the session starts", true
23
23
  on :f, "Suppress loading of ~/.pryrc"
24
24
  on "no-color", "Disable syntax highlighting for session"
25
-
25
+ on "no-plugins", "Suppress loading of plugins."
26
26
  on "simple-prompt", "Enable simple prompt mode" do
27
27
  Pry.prompt = Pry::SIMPLE_PROMPT
28
28
  end
@@ -50,15 +50,11 @@ end
50
50
  # invoked via cli
51
51
  Pry.cli = true
52
52
 
53
- Pry::Commands.instance_eval do
54
- command "reset", "Reset the REPL to a clean state." do
55
- output.puts "Pry reset."
56
- exec("pry")
57
- end
58
- end
59
-
60
53
  # load ~/.pryrc, if not suppressed with -f option
61
- Pry.should_load_rc = !opts.f?
54
+ Pry.config.should_load_rc = !opts.f?
55
+
56
+ # suppress plugins if given --no-plugins optino
57
+ Pry.config.plugins.enabled = false if opts["no-plugins"]
62
58
 
63
59
  # create the actual context
64
60
  context = Pry.binding_for(eval(opts[:context]))
@@ -1,7 +1,4 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  # define a local.
7
4
  a = "a local variable"
@@ -14,4 +11,5 @@ end
14
11
  # Start pry session at top-level.
15
12
  # The local variable `a` and the `hello` method will
16
13
  # be accessible.
14
+ puts __LINE__
17
15
  binding.pry
@@ -1,7 +1,4 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  # Inherit standard command set, but tweak them by importing some and
7
4
  # overriding others.
@@ -18,7 +15,7 @@ class MyCommands < Pry::CommandBase
18
15
 
19
16
  # analogy to Ruby's native alias_method idiom for decorating a method
20
17
  alias_command "old_status", "status", ""
21
-
18
+
22
19
  # Invoke one command from within another using `run`
23
20
  command "status", "Modified status." do |x|
24
21
  output.puts "About to show status, are you ready?"
@@ -1,7 +1,4 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  class MathCommands < Pry::CommandBase
7
4
  command "greet", "Greet a person, e.g: greet john" do |name|
@@ -1,12 +1,9 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  my_hooks = {
7
4
  :before_session => proc { |out, target| out.puts "Opening #{target.eval('self')}." },
8
5
  :after_session => proc { |out, target| out.puts "Closing #{target.eval('self')}." }
9
6
  }
10
-
7
+
11
8
  # Start a Pry session using the hooks hash defined in my_hooks
12
9
  Pry.start(TOPLEVEL_BINDING, :hooks => my_hooks)
@@ -1,7 +1,7 @@
1
1
  # Note: this requires you to have Gosu and TexPlay installed.
2
2
  # `gem install gosu`
3
3
  # `gem install texplay`
4
- #
4
+ #
5
5
  # Extra instructions for installing Gosu on Linux can be found here:
6
6
  # http://code.google.com/p/gosu/wiki/GettingStartedOnLinux
7
7
  #
@@ -10,11 +10,7 @@
10
10
  #
11
11
  # Have fun! :)
12
12
 
13
- direc = File.dirname(__FILE__)
14
-
15
- require 'rubygems'
16
- require "texplay"
17
- require "#{direc}/../lib/pry"
13
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
18
14
 
19
15
  WIDTH = 640
20
16
  HEIGHT = 480
@@ -42,12 +38,12 @@ class WinClass < Gosu::Window
42
38
  @img.rect 0, 0, @img.width - 1, @img.height - 1
43
39
 
44
40
  @binding = Pry.binding_for(@img)
45
-
41
+
46
42
  @pry_instance = Pry.new(:commands => ImageCommands, :prompt => IMAGE_PROMPT)
47
43
  end
48
44
 
49
45
  def draw
50
- @img.draw_rot(WIDTH / 2, HEIGHT / 2, 1, 0, 0.5, 0.5)
46
+ @img.draw_rot(WIDTH / 2, HEIGHT / 2, 1, 0, 0.5, 0.5)
51
47
  end
52
48
 
53
49
  def update
@@ -1,7 +1,4 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  # Create a StringIO that contains the input data
7
4
  str_input = StringIO.new("puts 'hello world!'\nputs \"I am in \#{self}\"\nexit")
@@ -1,7 +1,4 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  # Create a StringIO that contains the input data for all the Pry objects
7
4
  cmds = <<-CMDS
@@ -1,7 +1,4 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  # Create a StringIO to contain the output data
7
4
  str_output = StringIO.new
@@ -1,9 +1,6 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  my_print = proc { |out, value| out.puts "Output is: #{value.inspect}" }
7
-
4
+
8
5
  # Start a Pry session using the print object defined in my_print
9
6
  Pry.start(TOPLEVEL_BINDING, :print => my_print)
@@ -1,12 +1,9 @@
1
- direc = File.dirname(__FILE__)
2
-
3
- require 'rubygems'
4
- require "#{direc}/../lib/pry"
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
5
2
 
6
3
  # Remember, first prompt in array is the main prompt, second is the wait
7
4
  # prompt (used for multiline input when more input is required)
8
5
  my_prompt = [ proc { |obj, *| "inside #{obj}> " },
9
6
  proc { |obj, *| "inside #{obj}* "} ]
10
-
7
+
11
8
  # Start a Pry session using the prompt defined in my_prompt
12
9
  Pry.start(TOPLEVEL_BINDING, :prompt => my_prompt)
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ unless Object.const_defined? 'Pry'
3
+ $:.unshift File.expand_path '../../lib', __FILE__
4
+ require 'pry'
5
+ end
6
+
data/lib/pry.rb CHANGED
@@ -1,6 +1,65 @@
1
1
  # (C) John Mair (banisterfiend) 2011
2
2
  # MIT License
3
3
 
4
+ class Pry
5
+ # The default hooks - display messages when beginning and ending Pry sessions.
6
+ DEFAULT_HOOKS = {
7
+ :before_session => proc do |out, target|
8
+ # ensure we're actually in a method
9
+ meth_name = target.eval('__method__')
10
+ file = target.eval('__FILE__')
11
+
12
+ # /unknown/ for rbx
13
+ if file !~ /(\(.*\))|<.*>/ && file !~ /__unknown__/ && file != "" && file != "-e"
14
+ Pry.run_command "whereami 5", :output => out, :show_output => true, :context => target, :commands => Pry::Commands
15
+ end
16
+ end
17
+ }
18
+
19
+ # The default prints
20
+ DEFAULT_PRINT = proc do |output, value|
21
+ if Pry.color
22
+ output.puts "=> #{CodeRay.scan(Pry.view(value), :ruby).term}"
23
+ else
24
+ output.puts "=> #{Pry.view(value)}"
25
+ end
26
+ end
27
+
28
+ # Will only show the first line of the backtrace
29
+ DEFAULT_EXCEPTION_HANDLER = proc do |output, exception|
30
+ output.puts "#{exception.class}: #{exception.message}"
31
+ output.puts "from #{exception.backtrace.first}"
32
+ end
33
+
34
+ # The default prompt; includes the target and nesting level
35
+ DEFAULT_PROMPT = [
36
+ proc { |target_self, nest_level|
37
+ if nest_level == 0
38
+ "pry(#{Pry.view_clip(target_self)})> "
39
+ else
40
+ "pry(#{Pry.view_clip(target_self)}):#{Pry.view_clip(nest_level)}> "
41
+ end
42
+ },
43
+
44
+ proc { |target_self, nest_level|
45
+ if nest_level == 0
46
+ "pry(#{Pry.view_clip(target_self)})* "
47
+ else
48
+ "pry(#{Pry.view_clip(target_self)}):#{Pry.view_clip(nest_level)}* "
49
+ end
50
+ }
51
+ ]
52
+
53
+ # A simple prompt - doesn't display target or nesting level
54
+ SIMPLE_PROMPT = [proc { ">> " }, proc { ">* " }]
55
+
56
+ SHELL_PROMPT = [
57
+ proc { |target_self, _| "pry #{Pry.view_clip(target_self)}:#{Dir.pwd} $ " },
58
+ proc { |target_self, _| "pry #{Pry.view_clip(target_self)}:#{Dir.pwd} * " }
59
+ ]
60
+
61
+ end
62
+
4
63
  require "method_source"
5
64
  require 'shellwords'
6
65
  require "readline"
@@ -20,15 +79,13 @@ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
20
79
  end
21
80
 
22
81
  require "pry/version"
23
- require "pry/hooks"
24
- require "pry/print"
25
82
  require "pry/helpers"
26
83
  require "pry/command_set"
27
84
  require "pry/commands"
28
85
  require "pry/command_context"
29
- require "pry/prompts"
30
86
  require "pry/custom_completions"
31
87
  require "pry/completion"
88
+ require "pry/plugins"
32
89
  require "pry/core_extensions"
33
90
  require "pry/pry_class"
34
- require "pry/pry_instance"
91
+ require "pry/pry_instance"
@@ -4,25 +4,26 @@ class Pry
4
4
  class CommandContext
5
5
  attr_accessor :output
6
6
  attr_accessor :target
7
+ attr_accessor :captures
8
+ attr_accessor :eval_string
9
+ attr_accessor :arg_string
7
10
  attr_accessor :opts
8
11
  attr_accessor :command_set
9
12
  attr_accessor :command_processor
10
13
 
11
- def run(name, *args)
12
- if name.start_with? "."
13
- cmd = name[1..-1]
14
- command_processor.
15
- execute_system_command([name, Shellwords.join(args)].join(' '),
16
- target)
17
- else
18
- command_set.run_command(self, name, *args)
19
- end
14
+ def run(command_string, *args)
15
+ complete_string = "#{command_string} #{args.join(" ")}"
16
+ command_processor.process_commands(complete_string, eval_string, target)
20
17
  end
21
18
 
22
19
  def commands
23
20
  command_set.commands
24
21
  end
25
22
 
23
+ def text
24
+ Pry::Helpers::Text
25
+ end
26
+
26
27
  include Pry::Helpers::BaseHelpers
27
28
  include Pry::Helpers::CommandHelpers
28
29
  end
@@ -2,9 +2,6 @@ require 'forwardable'
2
2
 
3
3
  class Pry
4
4
  class CommandProcessor
5
- SYSTEM_COMMAND_DELIMITER = "."
6
- SYSTEM_COMMAND_REGEX = /^#{Regexp.escape(SYSTEM_COMMAND_DELIMITER)}(.*)/
7
-
8
5
  extend Forwardable
9
6
 
10
7
  attr_accessor :pry_instance
@@ -19,22 +16,16 @@ class Pry
19
16
  # @param [String] val The string passed in from the Pry prompt.
20
17
  # @return [Boolean] Whether the string is a valid command.
21
18
  def valid_command?(val)
22
- system_command?(val) || pry_command?(val)
19
+ !!(command_matched(val)[0])
23
20
  end
24
21
 
25
- # Is the string a valid system command?
26
- # @param [String] val The string passed in from the Pry prompt.
27
- # @return [Boolean] Whether the string is a valid system command.
28
- def system_command?(val)
29
- !!(SYSTEM_COMMAND_REGEX =~ val)
30
- end
31
-
32
- # Is the string a valid pry command?
33
- # A Pry command is a command that is not a system command.
34
- # @param [String] val The string passed in from the Pry prompt.
35
- # @return [Boolean] Whether the string is a valid Pry command.
36
- def pry_command?(val)
37
- !!command_matched(val).first
22
+ def convert_to_regex(obj)
23
+ case obj
24
+ when String
25
+ Regexp.escape(obj)
26
+ else
27
+ obj
28
+ end
38
29
  end
39
30
 
40
31
  # Revaluate the string (str) and perform interpolation.
@@ -49,41 +40,6 @@ class Pry
49
40
  target.eval(dumped_str)
50
41
  end
51
42
 
52
- # Execute a given system command.
53
- # The commands first have interpolation applied against the
54
- # `target` context.
55
- # All system command are forwarded to a shell. Note that the `cd`
56
- # command is special-cased and is converted internallly to a `Dir.chdir`
57
- # @param [String] val The system command to execute.
58
- # @param [Binding] target The context in which to perform string interpolation.
59
- def execute_system_command(val, target)
60
- SYSTEM_COMMAND_REGEX =~ val
61
- cmd = interpolate_string($1, target)
62
-
63
- if cmd =~ /^cd\s+(.+)/i
64
- begin
65
- @@cd_history ||= []
66
- if $1 == "-"
67
- dest = @@cd_history.pop || Dir.pwd
68
- else
69
- dest = File.expand_path($1)
70
- end
71
-
72
- @@cd_history << Dir.pwd
73
- Dir.chdir(dest)
74
- rescue Errno::ENOENT
75
- output.puts "No such directory: #{dest}"
76
- end
77
- else
78
- if !system(cmd)
79
- output.puts "Error: there was a problem executing system command: #{cmd}"
80
- end
81
- end
82
-
83
- # Tick, tock, im getting rid of this shit soon.
84
- val.replace("")
85
- end
86
-
87
43
  # Determine whether a Pry command was matched and return command data
88
44
  # and argument string.
89
45
  # This method should not need to be invoked directly.
@@ -91,10 +47,10 @@ class Pry
91
47
  # @return [Array] The command data and arg string pair
92
48
  def command_matched(val)
93
49
  _, cmd_data = commands.commands.find do |name, cmd_data|
94
- /^#{Regexp.escape(name)}(?!\S)(?:\s+(.+))?/ =~ val
50
+ /^#{convert_to_regex(name)}(?!\S)/ =~ val
95
51
  end
96
52
 
97
- [cmd_data, $1]
53
+ [cmd_data, (Regexp.last_match ? Regexp.last_match.captures : nil), (Regexp.last_match ? Regexp.last_match.end(0) : nil)]
98
54
  end
99
55
 
100
56
  # Process Pry commands. Pry commands are not Ruby methods and are evaluated
@@ -107,30 +63,32 @@ class Pry
107
63
  # multi-line input.
108
64
  # @param [Binding] target The receiver of the commands.
109
65
  def process_commands(val, eval_string, target)
110
- def val.clear() replace("") end
111
- def eval_string.clear() replace("") end
112
-
113
- if system_command?(val)
114
- execute_system_command(val, target)
115
- return
116
- end
117
66
 
118
67
  # no command was matched, so return to caller
119
- return if !pry_command?(val)
68
+ return if !valid_command?(val)
69
+ command, captures, pos = command_matched(val)
120
70
 
121
- val.replace interpolate_string(val, target)
122
- command, args_string = command_matched(val)
123
71
 
124
- args = args_string ? Shellwords.shellwords(args_string) : []
72
+ # perform ruby interpolation for commands
73
+ if command.options[:interpolate]
74
+ val.replace interpolate_string(val, target)
75
+ # command, captures, pos = command_matched(val)
76
+ # captures = captures.map { |v| interpolate_string(v, target) if v }
77
+ end
78
+
79
+ arg_string = val[pos..-1].strip
80
+ args = arg_string ? Shellwords.shellwords(arg_string) : []
125
81
 
126
82
  options = {
127
83
  :val => val,
84
+ :arg_string => arg_string,
128
85
  :eval_string => eval_string,
129
86
  :nesting => nesting,
130
- :commands => commands.commands
87
+ :commands => commands.commands,
88
+ :captures => captures
131
89
  }
132
90
 
133
- execute_command(target, command.name, options, *args)
91
+ execute_command(target, command.name, options, *(captures + args))
134
92
  end
135
93
 
136
94
  # Execute a Pry command.
@@ -146,6 +104,9 @@ class Pry
146
104
  context.opts = options
147
105
  context.target = target
148
106
  context.output = output
107
+ context.captures = options[:captures]
108
+ context.eval_string = options[:eval_string]
109
+ context.arg_string = options[:arg_string]
149
110
  context.command_set = commands
150
111
 
151
112
  context.command_processor = self
@@ -153,7 +114,7 @@ class Pry
153
114
  ret = commands.run_command(context, command, *args)
154
115
 
155
116
  # Tick, tock, im getting rid of this shit soon.
156
- options[:val].clear
117
+ options[:val].replace("")
157
118
 
158
119
  ret
159
120
  end