class ChefCLI::Command::Install

def apply_params!(params)

def apply_params!(params)
  remaining_args = parse_options(params)
  if remaining_args.size > 1
    ui.err(opt_parser)
    false
  else
    @policyfile_relative_path = remaining_args.first
    true
  end
end

def config_path

def config_path
  config[:config_file]
end

def debug?

def debug?
  !!config[:debug]
end

def handle_error(error)

def handle_error(error)
  ui.err("Error: #{error.message}")
  if error.respond_to?(:reason)
    ui.err("Reason: #{error.reason}")
    ui.err("")
    ui.err(error.extended_error_info) if debug?
    ui.err(error.cause.backtrace.join("\n")) if debug?
  end
end

def initialize(*args)

def initialize(*args)
  super
  @ui = UI.new
  @policyfile_relative_path = nil
  @installer = nil
end

def installer

def installer
  @installer ||= PolicyfileServices::Install.new(policyfile: policyfile_relative_path, ui: ui, root_dir: Dir.pwd, config: chef_config)
end

def run(params = [])

def run(params = [])
  return 1 unless apply_params!(params)
  # Force config file to be loaded. We don't use the configuration
  # directly, but the user may have SSL configuration options that they
  # need to talk to a private supermarket (e.g., trusted_certs or
  # ssl_verify_mode)
  chef_config
  installer.run
  0
rescue PolicyfileServiceError => e
  handle_error(e)
  1
end