changed some commands to include hyphens: install-command, pry-version, import-set

This commit is contained in:
John Mair 2011-07-27 03:14:24 +12:00
parent 954e366782
commit 9fc824a087
2 changed files with 20 additions and 3 deletions

View File

@ -243,7 +243,7 @@ class Pry
end
end
command "install", "Install a disabled command." do |name|
command "install-command", "Install a disabled command." do |name|
command = find_command(name)
stub_info = command.options[:stub_info]

View File

@ -16,17 +16,34 @@ class Pry
end
end
command "version", "Show Pry version." do
command "pry-version", "Show Pry version." do
output.puts "Pry version: #{Pry::VERSION} on Ruby #{RUBY_VERSION}."
end
command "import", "Import a command set" do |command_set_name|
command "import-set", "Import a command set" do |command_set_name|
next output.puts "Provide a command set name" if command_set.nil?
set = target.eval(arg_string)
Pry.active_instance.commands.import set
end
command "reload-method", "Reload the source file that contains the specified method" do |meth_name|
if (meth = get_method_object(meth_name, target, {})).nil?
output.puts "Invalid method name: #{meth_name}."
next
end
if is_a_c_method?(meth)
output.puts "Error: Can't reload a C method."
elsif is_a_dynamically_defined_method?(meth)
output.puts "Error: Can't reload an eval method."
else
file_name = meth.source_location.first
load file_name
output.puts "Reloaded #{file_name}."
end
end
command "reset", "Reset the REPL to a clean state." do
output.puts "Pry reset."
exec "pry"