Sha256: 1d923f36827d38697946c3d75e7c06bd5945ba38187324ed0a1b84c8d85427e3

Contents?: true

Size: 1.36 KB

Versions: 11

Compression:

Stored size: 1.36 KB

Contents

require 'pdk/cli/util'

module PDK::CLI
  @convert_cmd = @base_cmd.define_command do
    name 'convert'
    usage _('convert [options]')
    summary _('Convert an existing module to be compatible with the PDK.')

    PDK::CLI.template_url_option(self)
    PDK::CLI.skip_interview_option(self)
    PDK::CLI.full_interview_option(self)
    flag nil, :noop, _('Do not convert the module, just output what would be done.')
    flag nil, :force, _('Convert the module automatically, with no prompts.')

    run do |opts, _args, _cmd|
      require 'pdk/module/convert'

      PDK::CLI::Util.ensure_in_module!(
        check_module_layout: true,
        message:             _('`pdk convert` can only be run from inside a valid module directory.'),
        log_level:           :info,
      )

      if opts[:noop] && opts[:force]
        raise PDK::CLI::ExitWithError, _('You can not specify --noop and --force when converting a module')
      end

      if opts[:'skip-interview'] && opts[:'full-interview']
        PDK.logger.info _('Ignoring --full-interview and continuing with --skip-interview.')
        opts[:'full-interview'] = false
      end

      if opts[:force] && opts[:'full-interview']
        PDK.logger.info _('Ignoring --full-interview and continuing with --force.')
        opts[:'full-interview'] = false
      end

      PDK::Module::Convert.invoke(opts)
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
pdk-akerl-1.9.1.1 lib/pdk/cli/convert.rb
pdk-1.9.1 lib/pdk/cli/convert.rb
pdk-1.9.0 lib/pdk/cli/convert.rb
pdk-akerl-1.8.0.1 lib/pdk/cli/convert.rb
pdk-1.8.0 lib/pdk/cli/convert.rb
pdk-1.7.1 lib/pdk/cli/convert.rb
pdk-1.7.0 lib/pdk/cli/convert.rb
pdk-1.6.1 lib/pdk/cli/convert.rb
pdk-1.6.0 lib/pdk/cli/convert.rb
pdk-1.5.0 lib/pdk/cli/convert.rb
pdk-1.4.1 lib/pdk/cli/convert.rb