lib/ronin/ui/command_line/command_line.rb in ronin-0.2.3 vs lib/ronin/ui/command_line/command_line.rb in ronin-0.2.4
- old
+ new
@@ -65,15 +65,24 @@
#
# Returns the Command registered with the command-line utility
# with the specified _name_.
#
+ # CommandLine.get_command('gen_overlay')
+ # # => Ronin::UI::CommandLine::Commands::GenOverlay
+ #
def CommandLine.get_command(name)
name = name.to_s
+ #eventually someone is going to use a space or - which is going mess things up
+ #we will take care of this ahead of time here
+ name.gsub!(/[\s-]/, '_')
+
begin
require File.join(COMMANDS_DIR,name)
- rescue LoadError
+ rescue Gem::LoadError => e
+ raise(e)
+ rescue ::LoadError
raise(UnknownCommand,"unable to load the command #{name.dump}",caller)
end
class_name = name.to_const_string