Sha256: 91ca08cd666022fcebc8b050e324d71bb570483c81810f98f8a01ed8987d58f8

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

module PDK
  module CLI
    @new_provider_cmd = @new_cmd.define_command do
      name 'provider'
      usage 'provider [options] <name>'
      summary '[experimental] Create a new ruby provider named <name> using given options'

      run do |opts, args, _cmd|
        PDK::CLI::Util.ensure_in_module!

        provider_name = args[0]

        if provider_name.nil? || provider_name.empty?
          puts command.help
          exit 1
        end

        raise PDK::CLI::ExitWithError, format("'%{name}' is not a valid provider name", name: provider_name) unless Util::OptionValidator.valid_provider_name?(provider_name)

        require 'pdk/generate/provider'

        updates = PDK::Generate::Provider.new(PDK.context, provider_name, opts).run
        PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pdk-3.4.0 lib/pdk/cli/new/provider.rb
pdk-3.3.0 lib/pdk/cli/new/provider.rb