Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I have a little ruby script that pings our CI server and returns a :-) or a :-( based on if the build is passing or failing.

Now, what I'd like to do is make it red if it's a fail and green if it's passing. Can you evaluate the result of the script and set a differnet color based on that?

The status line from my tmux_conf:

set-option -g status-right #[default]Build:
  #(ruby ~/tmux_scripts/scripts/ci.rb) #[fg=green]#H#[default] %m/%d/%y %I:%M'
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I do not think this is documented—or even whether it is intentional functionality—but the attribute processing is done after the #() output is substituted, so your program can include its own bits of attribute syntax in its output.

To get the effect you want, have your Ruby program generate an output line similar to this:

#[bg=green]:-)#[default]

or this:

#[bg=red]:-(#[default]
share|improve this answer
    
That did it, thank you! –  DVG Sep 13 '13 at 11:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.