lib/aws/cfn/decompiler/main.rb in aws-cfn-decompiler-0.5.2 vs lib/aws/cfn/decompiler/main.rb in aws-cfn-decompiler-0.6.0
- old
+ new
@@ -16,13 +16,24 @@
on :j, :template=, 'The template to decompile', as: String
on :o, :output=, 'The directory to output the components to.', as: String
on :f, :format=, 'The output format of the components. [JSON|YAML|Ruby]', as: String, match: %r/ruby|rb|yaml|yml|json|js/i
on :s, :specification=, 'The specification file to create.', as: String
on :n, :functions=, 'Enable function use.', as: String, match: %r/0|1|yes|no|on|off|enable|disable|set|unset|true|false|raw/i
+ on :O, :overwrite, 'Overwrite existing generated source files. (HINT: Think twice ...)', { as: String, optional_argument: true, default: 'off', match: %r/0|1|yes|no|on|off|enable|disable|set|unset|true|false|raw/i }
end
- @config[:functions] = @opts[:functions].downcase.match %r'^(1|true|on|yes|enable|set)$'
+ @config[:overwrite] = if @opts[:overwrite].downcase.match %r'^(1|true|on|yes|enable|set)$'
+ true
+ else
+ false
+ end
+ @config[:functions] = if @opts[:functions]
+ (not @opts[:functions].downcase.match(%r'^(1|true|on|yes|enable|set)$').nil?)
+ else
+ false
+ end
+ @config[:directory] = @opts[:output]
unless @opts[:template]
@logger.error @opts
exit
end
@@ -35,15 +46,15 @@
@logger.error @opts.to_s
exit
end
end
- load @opts[:template]
+ load_template @opts[:template]
validate(@items)
output_dir = @opts[:output] || Dir.pwd
- save(output_dir)
+ save_dsl(output_dir)
@logger.step '*** Decompiled Successfully ***'
end
protected