Sha256: 483f2eae79cc4c38ababdf6e5d12d87e4d168b0a78ff305639d88996e5906234

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 Bytes

Contents

module PDK::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

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

      PDK::CLI::Util.analytics_screen_view('new_provider', opts)

      require 'pdk/generate/provider'

      PDK::Generate::Provider.new(PDK::Util.module_root, provider_name, opts).run
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pdk-1.17.0 lib/pdk/cli/new/provider.rb
pdk-1.16.0 lib/pdk/cli/new/provider.rb