def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases)
public
aliases = [commans_alias, flag], …
Show source
def self.def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases)
case cmd_class
when Symbol
cmd_class = cmd_class.id2name
when String
when Class
cmd_class = cmd_class.name
end
if load_file
eval %[
def #{cmd_name}(*opts, &b)
require "#{load_file}"
eval %[
def #{cmd_name}(*opts, &b)
ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
end
]
send :
end
]
else
eval %[
def #{cmd_name}(*opts, &b)
ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
end
]
end
for ali, flag in aliases
@ALIASES.push [ali, cmd_name, flag]
end
end