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

added find_command() to base_helpers to allow commands to look up a command by :listing name

This commit is contained in:
John Mair 2011-05-28 04:11:06 +12:00
parent 6270b60e0c
commit dd3aaf7132

View file

@ -18,7 +18,12 @@ class Pry
text.split.drop(1).join(' ') text.split.drop(1).join(' ')
end end
def find_command(name)
command_match = commands.find { |_, command| command.options[:listing] == name }
return command_match.last if command_match
nil
end
def gem_installed?(gem_name) def gem_installed?(gem_name)
require 'rubygems' require 'rubygems'