Sha256: 2038719dd9823158929232bd6a75899e41b45c367d8489f8db5b344b1f32f475
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 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) o[:as] = Array if info[:multiple] 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
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
sfn-0.4.6 | bin/sfn |
sfn-0.4.4 | bin/sfn |
sfn-0.4.2 | bin/sfn |
sfn-0.4.0 | bin/sfn |
sfn-0.3.8 | bin/sfn |
sfn-0.3.6 | bin/sfn |