bin/cfnlego in cfnlego-0.0.4 vs bin/cfnlego in cfnlego-0.0.5
- old
+ new
@@ -1,16 +1,33 @@
#!/usr/bin/env ruby
require_relative '../lib/cfnlego'
require 'optparse'
+require 'ruby-beautify'
+
+@indent_token = " "
+@indent_count = 2
+include RubyBeautify
options = {resources: []}
OptionParser.new do |opts|
opts.banner = "Usage: cfnlego --reousrce resource [options]"
- opts.on("-r", "--resource=RESOURCE_TYPE,RESOURCE_LOGICAL_NAME", "Add resource type and logical name") do |r|
+ opts.on("-r", "--resource RESOURCE_TYPE,RESOURCE_LOGICAL_NAME", "Add resource type and logical name") do |r|
options[:resources] << r
end
+ opts.on("-i", "--indent TOKEN", "Use TOKEN for indent character (default space)") do |i|
+ @indent_token = i
+ end
+
+ opts.on("-c",
+ "--indent-count [COUNT]",
+ Integer,
+ "Count of characters to use for indenting. (default: 2)") \
+ do |count|
+ @indent_count = count
+ end
+
opts.on("-h", "--help", "Prints this help") do
puts opts
puts <<-EXAMPLE
Example:
cfnlego \\
@@ -31,6 +48,8 @@
name = m[2]
resources << Cfnlego::Resource.new(type, name)
end
end
-puts Cfnlego::CloudFormation.new(resources).render
+puts pretty_string Cfnlego::CloudFormation.new(resources).render,
+ indent_token: @indent_token,
+ indent_count: @indent_count