mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
add more control on valid arguments for codecs in the generator command
Fixes #5419
This commit is contained in:
parent
ea4143602f
commit
0c1972a075
1 changed files with 6 additions and 5 deletions
|
@ -10,15 +10,12 @@ class LogStash::PluginManager::Generate < LogStash::PluginManager::Command
|
|||
|
||||
TYPES = [ "input", "filter", "output" ]
|
||||
|
||||
option "--type", "TYPE", "Type of the plugin {input, filter, output}s" do |arg|
|
||||
raise(ArgumentError, "should be one of: input, output or filter") unless TYPES.include?(arg)
|
||||
arg
|
||||
end
|
||||
|
||||
option "--type", "TYPE", "Type of the plugin {input, filter, output}s", :required => true
|
||||
option "--name", "PLUGIN", "Name of the new plugin", :required => true
|
||||
option "--path", "PATH", "Location where the plugin skeleton will be created", :default => Dir.pwd
|
||||
|
||||
def execute
|
||||
validate_params
|
||||
source = File.join(File.dirname(__FILE__), "templates", "#{type}-plugin")
|
||||
@target_path = File.join(path, full_plugin_name)
|
||||
FileUtils.mkdir(@target_path)
|
||||
|
@ -35,6 +32,10 @@ class LogStash::PluginManager::Generate < LogStash::PluginManager::Command
|
|||
|
||||
private
|
||||
|
||||
def validate_params
|
||||
raise(ArgumentError, "should be one of: input, output or filter") unless TYPES.include?(type)
|
||||
end
|
||||
|
||||
def create_scaffold(source, target)
|
||||
transform_r(source, target)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue