Sha256: 188e6f00ba37d57e8d26a8075ee150c317f413962cf4f446500c6b5695622c82
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
#!/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| 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 \\ --reousrce AutoScaling::AutoScalingGroup,ASG \\ --reousrce IAM::Role,Role \\ --reousrce IAM::InstanceProfile,InstanceProfile \\ EXAMPLE exit end end.parse! # Constructure Resources resources = [] options[:resources].each do |r| /(.*),(.*)/.match(r) do |m| type = m[1] name = m[2] resources << Cfnlego::Resource.new(type, name) end end puts pretty_string Cfnlego::CloudFormation.new(resources).render, indent_token: @indent_token, indent_count: @indent_count
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cfnlego-0.0.5 | bin/cfnlego |