exe/yee in xilight-0.1.2 vs exe/yee in xilight-0.1.5

- old
+ new

@@ -56,21 +56,15 @@ example [ "" ] def call(**) - current_config = ::Xilight::CLI.config - current_lights = current_config.fetch('yeelights', []) - ::Xilight::Yeelight.discover.each do |light| - current_lights.reject!{|l| l['id'] == light.id} - current_lights << light.instance_variables.map{|v| [v.to_s[1..-1], light.instance_variable_get(v)] }.to_h - end - current_config['yeelights'] = current_lights - current_lights.each_with_index do |light, index| - puts "Light ##{index} => #{(light['name'] || light['id'])}@#{light['host']}" - end - ::Xilight::CLI.config = current_config + ::Xilight::CLI.config = { + 'yeelights' => ::Xilight::Yeelight.discover.each do |light| + light.instance_variables.map{|v| [v.to_s[1..-1], light.instance_variable_get(v)] }.to_h + end + } end end class List < Dry::CLI::Command desc "List known Yeelights" @@ -234,10 +228,10 @@ COLORS.each do |color, values| class_name = color.to_s[0].upcase + color.to_s[1..-1] Object.const_set(class_name, Class.new(Dry::CLI::Command) do desc "Set yeelight to color #{color}" example [ - "#{color}" + "" ] option :light, desc: "ID/index of Yeelight to target", default: "0", aliases: ["-l"] option :name, desc: "Name of Yeelight to target", default: nil, aliases: ["-n"] \ No newline at end of file