From 4abf514b90014549a405a3768aff41dc45fdb631 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sun, 16 Nov 2014 00:11:32 +0100 Subject: [PATCH] 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. --- huec | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/huec b/huec index b959eee..905733d 100755 --- a/huec +++ b/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)