Module: Hue::CLI

Defined in:
lib/hue/cli.rb,
lib/hue/cli/command.rb,
lib/hue/cli/commands/light.rb,
lib/hue/cli/commands/register.rb

Defined Under Namespace

Modules: Commands Classes: Command, Error

Class Method Summary collapse

Class Method Details

.bridgeObject



12
13
14
# File 'lib/hue/cli.rb', line 12

def self.bridge
  Hue.application
end

.run(args = []) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hue/cli.rb', line 16

def self.run(args = [])
  commands = commands_in_object_space

  if args.size > 0
    first_arg = args.shift
    if command = commands[first_arg.to_sym]
      command.new.execute(*args)
    else
      Commands::Light.new.execute(first_arg, *args)
    end
  else
    print_default
  end
rescue Hue::Error => err
  puts err.message
rescue Hue::CLI::Error => err
  puts err.message
end