Method: CouchShell::PluginClass#cmd

Defined in:
lib/couch-shell/plugin.rb

#cmd(doc_line, opts = {}) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
# File 'lib/couch-shell/plugin.rb', line 163

def cmd(doc_line, opts = {})
  opts[:doc_line] = doc_line
  Decorate.decorate { |klass, method_name|
    if !opts[:name] && method_name =~ /\Aexecute_(.+)\z/
      opts[:name] = $1
    end
    opts[:execute_message] = method_name
    opts[:plugin] = plugin_info
    plugin_info.register_command CommandInfo.new(opts)
  }
end