6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/pdk/generate/module.rb', line 6
def self.validate_options(opts)
require 'pdk/cli/util/option_validator'
unless PDK::CLI::Util::OptionValidator.valid_module_name?(opts[:module_name])
error_msg = _(
"'%{module_name}' is not a valid module name.\n" \
'Module names must begin with a lowercase letter and can only include lowercase letters, digits, and underscores.',
) % { module_name: opts[:module_name] }
raise PDK::CLI::ExitWithError, error_msg
end
target_dir = PDK::Util::Filesystem.expand_path(opts[:target_dir])
raise PDK::CLI::ExitWithError, _("The destination directory '%{dir}' already exists") % { dir: target_dir } if PDK::Util::Filesystem.exist?(target_dir)
end
|