mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Added CommandContext#run
This commit is contained in:
parent
b0f8b72da0
commit
b14be6c0c4
4 changed files with 17 additions and 10 deletions
|
@ -33,7 +33,6 @@ require "pry/core_extensions"
|
||||||
require "pry/pry_class"
|
require "pry/pry_class"
|
||||||
require "pry/pry_instance"
|
require "pry/pry_instance"
|
||||||
|
|
||||||
|
|
||||||
# TEMPORARY HACK FOR BUG IN JRUBY 1.9 REGEX (which kills CodeRay)
|
# TEMPORARY HACK FOR BUG IN JRUBY 1.9 REGEX (which kills CodeRay)
|
||||||
if RUBY_VERSION =~ /1.9/ && RUBY_ENGINE =~ /jruby/
|
if RUBY_VERSION =~ /1.9/ && RUBY_ENGINE =~ /jruby/
|
||||||
Pry.color = false
|
Pry.color = false
|
||||||
|
|
|
@ -5,7 +5,15 @@ class Pry
|
||||||
attr_accessor :output
|
attr_accessor :output
|
||||||
attr_accessor :target
|
attr_accessor :target
|
||||||
attr_accessor :opts
|
attr_accessor :opts
|
||||||
attr_accessor :commands
|
attr_accessor :command_set
|
||||||
|
|
||||||
|
def run(name, *args)
|
||||||
|
command_set.run_command(self, name, *args)
|
||||||
|
end
|
||||||
|
|
||||||
|
def commands
|
||||||
|
command_set.commands
|
||||||
|
end
|
||||||
|
|
||||||
include Pry::Helpers::BaseHelpers
|
include Pry::Helpers::BaseHelpers
|
||||||
include Pry::Helpers::CommandHelpers
|
include Pry::Helpers::CommandHelpers
|
||||||
|
|
|
@ -143,10 +143,10 @@ class Pry
|
||||||
context = CommandContext.new
|
context = CommandContext.new
|
||||||
|
|
||||||
# set some useful methods to be used by the action blocks
|
# set some useful methods to be used by the action blocks
|
||||||
context.opts = options
|
context.opts = options
|
||||||
context.target = target
|
context.target = target
|
||||||
context.output = output
|
context.output = output
|
||||||
context.commands = commands.commands
|
context.command_set = commands
|
||||||
|
|
||||||
ret = commands.run_command(context, command, *args)
|
ret = commands.run_command(context, command, *args)
|
||||||
|
|
||||||
|
|
|
@ -195,10 +195,10 @@ class Pry
|
||||||
context = CommandContext.new
|
context = CommandContext.new
|
||||||
commands = options[:commands]
|
commands = options[:commands]
|
||||||
|
|
||||||
context.opts = {}
|
context.opts = {}
|
||||||
context.output = options[:show_output] ? options[:output] : null_output
|
context.output = options[:show_output] ? options[:output] : null_output
|
||||||
context.target = Pry.binding_for(options[:context])
|
context.target = Pry.binding_for(options[:context])
|
||||||
context.commands = commands.commands
|
context.command_set = commands
|
||||||
|
|
||||||
commands.run_command(context, name, *Shellwords.shellwords(arg_string))
|
commands.run_command(context, name, *Shellwords.shellwords(arg_string))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue