Module: Idcf::Cli::Controller::Extend::Command
- Included in:
- Init
- Defined in:
- lib/idcf/cli/controller/extend/command.rb
Overview
command
Instance Method Summary collapse
-
#register_method_option!(values) ⇒ Object
regist method option.
-
#register_module_method!(name, cls) ⇒ Object
register module mothod.
-
#register_schema_method_by_link!(link) ⇒ Object
register schema method by link.
Instance Method Details
#register_method_option!(values) ⇒ Object
regist method option
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/idcf/cli/controller/extend/command.rb', line 36 def register_method_option!(values) return nil if values.nil? values.each do |opn, op| option = {} op.each do |ok, ov| option[ok.to_sym] = ov end method_option opn, option end end |
#register_module_method!(name, cls) ⇒ Object
register module mothod
25 26 27 28 29 30 31 |
# File 'lib/idcf/cli/controller/extend/command.rb', line 25 def register_module_method!(name, cls) register_method_option! cls. desc "#{name} #{cls.make_param_s}", cls.description define_method name.to_sym do |*args| execute(__method__, *args) end end |
#register_schema_method_by_link!(link) ⇒ Object
register schema method by link
12 13 14 15 16 17 18 19 |
# File 'lib/idcf/cli/controller/extend/command.rb', line 12 def register_schema_method_by_link!(link) param_str = Idcf::Cli::Lib::Api.command_param_str(link) method_desc = "#{link.title} #{param_str}" desc method_desc.strip, link.description define_method link.title.to_sym do |*args| execute(__method__, *args) end end |