Sha256: 7e31c2c17390ac34ec2facae6d73bc955d37caf1d03eeb8f2c1dc304363d10d2
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
class <%= resource_name.camelize %> < <%= class_base %><%= class_suffix %>::CliCommand <% resource[:methods].each do |method| -%> desc '<%= method[:name] %>', '<%= api(method)[:short_description] %>' <% params_in_path(method).each do |param| -%> method_option :<%= param %>, :required => 'true' <% end method[:params].map {|p| p[:expected_type] == "hash" ? (p[:params] || p) : p}.flatten.each do |param| -%> method_option :<%= param[:name] %>, :required => <%= param[:required] ? 'true' : 'false' %>, :desc => '<%= plaintext(param[:description]) %>', :type => :<%= param[:expected_type] %> <% end -%> def <%= method[:name] %> <% if params_in_path(method).any? || transformation_hash(method).any? transform_options_params = [params_in_path(method).inspect] transform_options_params << transformation_hash(method).inspect if transformation_hash(method).any? -%> <%= (params_in_path(method) + ["options"]).join(", ") %>, *_ = transform_options(<%= transform_options_params.join(", ").html_safe %>) <% end client_args = params_in_path(method).dup client_args << "options" if method[:params].any? -%> data, resp = client.<%= method[:name] %><%= "(#{client_args.join(", ")})" if client_args.any? %> print_data(data) end <% end -%> end
Version data entries
4 entries across 4 versions & 1 rubygems