Created
December 31, 2012 04:12
-
-
Save robertsosinski/4417305 to your computer and use it in GitHub Desktop.
Color Pry prompt according to environment, put this at the bottom of your config/environment.rb file and specify "prompt_color" in the config/<environment> file with config.prompt_color = <environment>.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Color Pry prompt according to environment | |
old_prompt = Pry.config.prompt | |
color = { | |
:red => "31m", | |
:green => "32m", | |
:yellow => "33m", | |
:blue => "34m", | |
:purple => "35m", | |
:cyan => "36m" | |
} | |
prompt_color = color[(Pos::Application.config.prompt_color rescue nil)] || color[:red] | |
Pry.config.prompt = [ | |
proc {|a,b,c| "\e[#{prompt_color}#{(Rails.env)}\e[0m #{old_prompt.first.call(a,b,c)}"}, | |
proc {|a,b,c| "\e[#{prompt_color}#{(Rails.env)}\e[0m #{old_prompt.second.call(a,b,c)}"}, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment