Sha256: 56897991a479a197640bee3a8736fd81665e42d11c0fde5373634f19ccd1ff09

Contents?: true

Size: 796 Bytes

Versions: 5

Compression:

Stored size: 796 Bytes

Contents

module PDK::CLI
  @new_define_cmd = @new_cmd.define_command do
    name 'defined_type'
    usage _('defined_type [options] <name>')
    summary _('Create a new defined type named <name> using given options')

    PDK::CLI.template_url_option(self)

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

      defined_type_name = args[0]
      module_dir = Dir.pwd

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

      unless Util::OptionValidator.valid_defined_type_name?(defined_type_name)
        raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid defined type name") % { name: defined_type_name }
      end

      PDK::Generate::DefinedType.new(module_dir, defined_type_name, opts).run
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pdk-1.3.1 lib/pdk/cli/new/defined_type.rb
pdk-1.3.0 lib/pdk/cli/new/defined_type.rb
pdk-1.2.1 lib/pdk/cli/new/defined_type.rb
pdk-1.2.0 lib/pdk/cli/new/defined_type.rb
pdk-1.1.0 lib/pdk/cli/new/defined_type.rb