2011-04-25 13:26:25 +02:00
|
|
|
class Pry
|
|
|
|
# Command contexts are the objects runing each command.
|
|
|
|
# Helper modules can be mixed into this class.
|
|
|
|
class CommandContext
|
|
|
|
attr_accessor :output
|
|
|
|
attr_accessor :target
|
|
|
|
attr_accessor :opts
|
2011-04-25 23:13:36 +02:00
|
|
|
attr_accessor :command_set
|
2011-04-29 18:14:48 +02:00
|
|
|
attr_accessor :command_processor
|
2011-04-25 23:13:36 +02:00
|
|
|
|
|
|
|
def run(name, *args)
|
2011-04-26 23:44:49 +02:00
|
|
|
if name.start_with? "."
|
|
|
|
cmd = name[1..-1]
|
2011-04-29 18:17:49 +02:00
|
|
|
command_processor.
|
|
|
|
execute_system_command([name, Shellwords.join(args)].join(' '),
|
|
|
|
target)
|
2011-04-26 23:44:49 +02:00
|
|
|
else
|
|
|
|
command_set.run_command(self, name, *args)
|
|
|
|
end
|
2011-04-25 23:13:36 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def commands
|
|
|
|
command_set.commands
|
|
|
|
end
|
2011-04-25 13:26:25 +02:00
|
|
|
|
2011-05-06 18:28:12 +01:00
|
|
|
def text
|
2011-05-08 18:38:14 +01:00
|
|
|
Pry::Helpers::Text
|
2011-05-06 18:28:12 +01:00
|
|
|
end
|
|
|
|
|
2011-04-25 22:58:06 +02:00
|
|
|
include Pry::Helpers::BaseHelpers
|
|
|
|
include Pry::Helpers::CommandHelpers
|
2011-04-25 13:26:25 +02:00
|
|
|
end
|
|
|
|
end
|