Module: SfCli::Sf::Lightning::Generate

Included in:
Core
Defined in:
lib/sf_cli/sf/lightning/generate.rb

Instance Method Summary collapse

Instance Method Details

#generate_component(name, type: nil, output_dir: nil, template: nil, api_version: nil, raw_output: false) ⇒ Array

Generate an Apex class

Parameters:

  • name (String, Symbol)

    component name

  • type (String, Symbol) (defaults to: nil)

    component type.Only aura or lwc is permissible.

  • output_dir (String) (defaults to: nil)

    directory for saving the created files

  • template (String, Symbol) (defaults to: nil)

    Template to use for file creation.Permissible values are: default, analyticsDashboard, analyticsDashboardWithStep

  • api_version (Numeric) (defaults to: nil)

    override the api version used for api requests made by this command

  • raw_output (Boolian) (defaults to: false)

    output what original command shows

Returns:

  • (Array)

    the list of files that is created

See Also:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sf_cli/sf/lightning/generate.rb', line 15

def generate_component(name, type: nil, output_dir: nil, template: nil, api_version: nil, raw_output: false)
  flags = {
    :"name" => name,
    :"output-dir"  => output_dir,
    :"type"        => type,
    :"template"    => template,
    :"api-version" => api_version,
  }
  switches = {
  }
  command_output_format = raw_output ? :human : :json
  redirect_type = raw_output ? nil : :null_stderr
  action = __method__.to_s.tr('_', ' ')
  output = exec(action, flags: flags, switches: switches, redirection: redirect_type, raw_output: raw_output, format: command_output_format)
  return output if raw_output

  output['result']['created']
end