Sha256: 96ff2cc7d8e66068321f6b1b69f176cf0452f9bd5a91c0b22585a2d6a24cc464

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 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]
      module_dir = Dir.pwd

      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)

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pdk-1.13.0 lib/pdk/cli/new/provider.rb
pdk-1.12.0 lib/pdk/cli/new/provider.rb
pdk-1.11.1 lib/pdk/cli/new/provider.rb
pdk-1.11.0 lib/pdk/cli/new/provider.rb