2011-05-11 02:49:32 +00:00
|
|
|
class Pry
|
|
|
|
module DefaultCommands
|
|
|
|
|
|
|
|
Basic = Pry::CommandSet.new do
|
|
|
|
command "toggle-color", "Toggle syntax highlighting." do
|
|
|
|
Pry.color = !Pry.color
|
|
|
|
output.puts "Syntax highlighting #{Pry.color ? "on" : "off"}"
|
|
|
|
end
|
|
|
|
|
|
|
|
command "simple-prompt", "Toggle the simple prompt." do
|
|
|
|
case Pry.active_instance.prompt
|
|
|
|
when Pry::SIMPLE_PROMPT
|
2011-05-29 15:38:23 +00:00
|
|
|
Pry.active_instance.pop_prompt
|
2011-05-11 02:49:32 +00:00
|
|
|
else
|
2011-05-29 15:38:23 +00:00
|
|
|
Pry.active_instance.push_prompt Pry::SIMPLE_PROMPT
|
2011-05-11 02:49:32 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
command "version", "Show Pry version." do
|
|
|
|
output.puts "Pry version: #{Pry::VERSION} on Ruby #{RUBY_VERSION}."
|
|
|
|
end
|
|
|
|
|
2011-05-11 09:39:15 +00:00
|
|
|
command "import", "Import a command set" do |command_set_name|
|
|
|
|
next output.puts "Provide a command set name" if command_set.nil?
|
2011-05-11 02:49:32 +00:00
|
|
|
|
2011-05-30 03:57:06 +00:00
|
|
|
set = target.eval(arg_string)
|
2011-05-11 09:39:15 +00:00
|
|
|
Pry.active_instance.commands.import set
|
2011-05-11 02:49:32 +00:00
|
|
|
end
|
2011-05-11 09:39:15 +00:00
|
|
|
|
2011-05-19 18:10:16 +00:00
|
|
|
command "reset", "Reset the REPL to a clean state." do
|
|
|
|
output.puts "Pry reset."
|
|
|
|
exec "pry"
|
|
|
|
end
|
2011-05-11 02:49:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|