lib/eco/cli/config/options_set.rb in eco-helpers-2.5.10 vs lib/eco/cli/config/options_set.rb in eco-helpers-2.6.0

- old
+ new

@@ -42,18 +42,18 @@ end # @param option [String, Array<String>] the command line option(s). # @param namespace [String] preceding command(s) argument that enables this option. # @param desc [String] description of the option. - def add(option, desc = nil, namespace: :general) + def add(option, desc = nil, namespace: :general, &block) raise "Missing block to define the options builder" unless block_given? opts = [option].flatten.compact unless opts.empty? - callback = Proc.new + callback = block opts.each do |opt| - puts "Overriding option '#{option}' in '#{namespace}' namespace" if option_exists?(opt, namespace) + puts "Overriding CLI option '#{option}' in '#{namespace}' CLI case / namespace" if option_exists?(opt, namespace) options_set(namespace)[opt] = OptConfig.new(opt, namespace, desc, callback) end end self end @@ -137,10 +137,9 @@ end def options_set(namespace = :general) @sets[namespace] ||= {} end - end end end end