1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

now passing capture groups in as arguments to commands (prior to regular arguments). Now stripping spaces around arg_string

This commit is contained in:
John Mair 2011-05-28 04:17:25 +12:00
parent 2f3ab643ab
commit e3af5f3a1a

View file

@ -2,7 +2,7 @@ require 'forwardable'
class Pry class Pry
class CommandProcessor class CommandProcessor
SYSTEM_COMMAND_DELIMITER = "." SYSTEM_COMMAND_DELIMITER = "^"
SYSTEM_COMMAND_REGEX = /^#{Regexp.escape(SYSTEM_COMMAND_DELIMITER)}(.*)/ SYSTEM_COMMAND_REGEX = /^#{Regexp.escape(SYSTEM_COMMAND_DELIMITER)}(.*)/
extend Forwardable extend Forwardable
@ -131,7 +131,7 @@ class Pry
val.replace interpolate_string(val, target) if command.options[:interpolate] val.replace interpolate_string(val, target) if command.options[:interpolate]
arg_string = val[pos..-1] arg_string = val[pos..-1].strip
args = arg_string ? Shellwords.shellwords(arg_string) : [] args = arg_string ? Shellwords.shellwords(arg_string) : []
@ -144,7 +144,7 @@ class Pry
:captures => captures :captures => captures
} }
execute_command(target, command.name, options, *args) execute_command(target, command.name, options, *captures, *args)
end end
# Execute a Pry command. # Execute a Pry command.
@ -160,6 +160,9 @@ class Pry
context.opts = options context.opts = options
context.target = target context.target = target
context.output = output context.output = output
context.captures = options[:captures]
context.eval_string = options[:eval_string]
context.arg_string = options[:arg_string]
context.command_set = commands context.command_set = commands
context.command_processor = self context.command_processor = self