Module: PDK::CLI

Defined in:
lib/pdk/cli.rb,
lib/pdk/cli/new.rb,
lib/pdk/cli/exec.rb,
lib/pdk/cli/test.rb,
lib/pdk/cli/util.rb,
lib/pdk/cli/bundle.rb,
lib/pdk/cli/errors.rb,
lib/pdk/cli/validate.rb,
lib/pdk/cli/new/class.rb,
lib/pdk/cli/test/unit.rb,
lib/pdk/cli/exec_group.rb,
lib/pdk/cli/new/module.rb,
lib/pdk/cli/util/interview.rb,
lib/pdk/cli/util/option_validator.rb,
lib/pdk/cli/util/option_normalizer.rb

Defined Under Namespace

Modules: Exec, Util Classes: ExecGroup, FatalError

Class Method Summary collapse

Class Method Details

.run(args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pdk/cli.rb', line 15

def self.run(args)
  @base_cmd.run(args)
rescue PDK::CLI::FatalError => e
  PDK.logger.fatal(e.message) if e.message

  # If FatalError was raised as the result of another exception, send the
  # details of that exception to the debug log. If there was no cause
  # (FatalError raised on its own outside a rescue block), send the details
  # of the FatalError exception to the debug log.
  cause = e.cause
  if cause.nil?
    e.backtrace.each { |line| PDK.logger.debug(line) }
  else
    PDK.logger.debug("#{cause.class}: #{cause.message}")
    cause.backtrace.each { |line| PDK.logger.debug(line) }
  end

  exit e.exit_code
end

.template_url_option(dsl) ⇒ Object



35
36
37
# File 'lib/pdk/cli.rb', line 35

def self.template_url_option(dsl)
  dsl.option nil, 'template-url', _('Specifies the URL to the template to use when creating new modules, and other parts.'), argument: :required, default: PDK::Generate::Module.default_template_url
end