Use a custom prompt
In the prompt, show a character per lights that is a green/red `o' for on/off or a bright red `x' for unreachable.
This commit is contained in:
parent
ddac8fc45e
commit
4abf514b90
9
huec
9
huec
|
@ -51,6 +51,14 @@ def status_line(blb)
|
|||
return line
|
||||
end
|
||||
|
||||
def prompt_status
|
||||
Huey::Bulb.all.map do |blb|
|
||||
if blb.reachable
|
||||
blb.on ? Rainbow("o").bright.green : Rainbow("o").red
|
||||
else
|
||||
Rainbow("x").bright.red
|
||||
end
|
||||
end.join
|
||||
end
|
||||
|
||||
def lights
|
||||
|
@ -148,4 +156,5 @@ def commands
|
|||
EOT
|
||||
end
|
||||
|
||||
Pry.config.prompt = proc { "#{prompt_status}> " }
|
||||
binding.pry(quiet: true)
|
||||
|
|
Reference in New Issue