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
|
return line
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def lights
|
def lights
|
||||||
|
@ -148,4 +156,5 @@ def commands
|
||||||
EOT
|
EOT
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Pry.config.prompt = proc { "#{prompt_status}> " }
|
||||||
binding.pry(quiet: true)
|
binding.pry(quiet: true)
|
||||||
|
|
Reference in New Issue