Top Level Namespace

Defined Under Namespace

Modules: CrossPlane, Crossplane Classes: CLI

Instance Method Summary collapse

Instance Method Details

#configure_options(thor, opt_type, opts) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/crossplane/cli.rb', line 22

def configure_options(thor, opt_type, opts)
	opts = opts.sort_by { |k| k[:name].to_s }
	opts.each do |opt|
		required = opt.key?(:required) ? opt[:required] : false
		aliases = opt.key?(:aliases) ? opt[:aliases] : []
		if opt_type == "class"
			thor.class_option(opt[:name], :banner => opt[:banner], :desc => opt[:desc], :aliases => aliases, :required => required, :type => opt[:type])
		elsif opt_type == "method"
			thor.method_option(opt[:name], :banner => opt[:banner], :desc => opt[:desc], :aliases => aliases, :required => required, :type => opt[:type])
		end
	end
end