Added some comments to make it more clear.

This commit is contained in:
Daniël Franke 2011-10-24 15:27:53 +02:00
commit f4fb47b2e0

View file

@ -8,6 +8,7 @@
# PRODUCTION_RE='^prod-' # PRODUCTION_RE='^prod-'
# And for yellow: # And for yellow:
# STAGING_RE='^staging-' # STAGING_RE='^staging-'
# The contents are regular expression against which the host is matched,
# Default user colour # Default user colour
us_col=$fg[green] us_col=$fg[green]
@ -16,19 +17,18 @@ if [[ `whoami` == 'root' ]]; then
us_col=$fg[red] us_col=$fg[red]
fi fi
# Default host colour.
host_col=$fg[green] host_col=$fg[green]
local hostname=`hostname` local hostname=`hostname`
# Set the host colour red if it matches the production regex.
if [[ "$PRODUCTION_RE" != "" && "$hostname" =~ "$PRODUCTION_RE" ]]; then if [[ "$PRODUCTION_RE" != "" && "$hostname" =~ "$PRODUCTION_RE" ]]; then
host_col=$fg[red] host_col=$fg[red]
# And yellow if it matches the staging regex.
elif [[ "$STAGING_RE" != "" && $hostname =~ $STAGING_RE ]]; then elif [[ "$STAGING_RE" != "" && $hostname =~ $STAGING_RE ]]; then
host_col=$fg[yellow] host_col=$fg[yellow]
fi fi
local start_angular="%{$fg_bold[white]%}[%{$reset_color%}" local start_angular="%{$fg_bold[white]%}[%{$reset_color%}"
local user_at_host="%{$us_col%}%n%{$reset_color%}%{$fg_bold[yellow]%}@%{$reset_color%}%{$host_col%}%m%{$reset_color%}" local user_at_host="%{$us_col%}%n%{$reset_color%}%{$fg_bold[yellow]%}@%{$reset_color%}%{$host_col%}%m%{$reset_color%}"
local current_path="%{$fg[cyan]%}%2c%{$reset_color%}" local current_path="%{$fg[cyan]%}%2c%{$reset_color%}"