From 3eadab9d18357c88b19e3f3b26a4d9040c217dd5 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 27 Mar 2021 18:20:59 +0100 Subject: LV2/makeplugin: Add --pristine cmd line arg. This arg will make the plugin from scratch, throwing away any existing port of the same plugin. --- plugins/LV2/makeplugin | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/plugins/LV2/makeplugin b/plugins/LV2/makeplugin index 04d3195..e8ff889 100755 --- a/plugins/LV2/makeplugin +++ b/plugins/LV2/makeplugin @@ -8,15 +8,35 @@ def make_param_assigns(ctrl_ports) .join("\n ") end +def usage + puts "Usage: #{__FILE__} [--pristine] " + puts "\nFlags:\n" + puts "\t--pristine\t- Make pristine plugin (deletes existing if it exists)" + exit +end if ARGV.length < 1 - puts "Usage: #{__FILE__} " - exit + usage end -root = File.dirname(__FILE__) +opt = {} +plugin_name = '' + +ARGV.each do |arg| + case arg + when /^--pristine$/ + opt[:pristine] = true + else + plugin_name = arg + end +end -plugin_name = ARGV[0] +if plugin_name.empty? + puts "Missing plugin name!" + usage +end + +root = File.dirname(__FILE__) target_dir = File.join(root, 'src', plugin_name) template_dir = File.join(root, 'Template') @@ -37,6 +57,7 @@ Templates = %w{ } begin + FileUtils.remove_dir(target_dir) if opt[:pristine] and Dir.exist?(target_dir) Dir.mkdir(target_dir) plugin_ttl = MakePlugin::PluginDescriptionTemplate.new(template_dir, pi) -- cgit v1.2.3