Method: Thor.command_regist

Defined in:
lib/idcf/cli/gem_ext/thor/init_util.rb

.command_regist(command, require_path, arg) ⇒ Object

command regist

Parameters:

  • command (String)
  • require_path (String)
  • o (Hash)

    options



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/idcf/cli/gem_ext/thor/init_util.rb', line 46

def command_regist(command, require_path, arg)
  require require_path

  class_const = require_path.classify.constantize
  class_const.init(arg) if arg.include?(command) || map.values.include?(command.to_sym)

  register class_const,
           command,
           "#{command_help_string(command)} [OPTION]",
           class_const.description
end