Sha256: 81df5bbfd8d4af52de149faceb5815a38d8c5baabf79f499df1682ce9bfae907
Contents?: true
Size: 1.14 KB
Versions: 19
Compression:
Stored size: 1.14 KB
Contents
#!/usr/bin/env ruby require 'bogo-cli' require 'sfn' Bogo::Cli::Setup.define do on :v, :version, 'Print version ' do puts "sfn - SparkleFormation CLI - [Version: #{Sfn::VERSION}]" exit end Sfn::Config.constants.map do |konst| const = Sfn::Config.const_get(konst) if(const.is_a?(Class) && const.ancestors.include?(Bogo::Config)) const end end.compact.sort_by(&:to_s).each do |klass| klass_name = klass.name.split('::').last.downcase command klass_name do if(klass.const_defined?(:DESCRIPTION)) description klass.const_get(:DESCRIPTION) end Sfn::Config.options_for(klass).each do |name, info| on_name = info[:boolean] ? info[:long] : "#{info[:long]}=" opts = Hash.new.tap do |o| o[:default] = info[:default] if info.has_key?(:default) if(info[:multiple]) o[:as] = Array o[:delimiter] = nil end end on info[:short], on_name, info[:description], opts end run do |opts, args| Bogo::Utility.constantize(klass.to_s.sub('Config', 'Command')).new(opts, args).execute! end end end end
Version data entries
19 entries across 19 versions & 1 rubygems