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:
Paul van Tilburg 2014-11-16 00:11:32 +01:00
parent ddac8fc45e
commit 4abf514b90
1 changed files with 9 additions and 0 deletions

9
huec
View File

@ -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)