ip address can be enabled/disabled (default is enabled)
parent
758c57621a
commit
86aa9ff36a
|
|
@ -75,6 +75,9 @@ MAX_GIT_HEX_LENGTH=5
|
||||||
# IP address
|
# IP address
|
||||||
IP_SEPARATOR=', '
|
IP_SEPARATOR=', '
|
||||||
|
|
||||||
|
# Show IP
|
||||||
|
IP_ENABLED=1
|
||||||
|
|
||||||
# FUNCS =======================================================================
|
# FUNCS =======================================================================
|
||||||
|
|
||||||
function ip {
|
function ip {
|
||||||
|
|
@ -82,6 +85,13 @@ function ip {
|
||||||
echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}"
|
echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Displays ip prompt
|
||||||
|
function ip_prompt_info() {
|
||||||
|
if [[ $IP_ENABLED == 1 ]]; then
|
||||||
|
echo -e " ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Displays virtual info prompt (virtualenv/rvm)
|
# Displays virtual info prompt (virtualenv/rvm)
|
||||||
function virtual_prompt_info() {
|
function virtual_prompt_info() {
|
||||||
local virtual_env_info=$(virtualenv_prompt)
|
local virtual_env_info=$(virtualenv_prompt)
|
||||||
|
|
@ -176,9 +186,9 @@ function prompt() {
|
||||||
[ $UID -eq "0" ] && UC=$SUPERUSER_COLOR
|
[ $UID -eq "0" ] && UC=$SUPERUSER_COLOR
|
||||||
|
|
||||||
if [[ $VIRTUAL_PROMPT_ENABLED == 1 ]]; then
|
if [[ $VIRTUAL_PROMPT_ENABLED == 1 ]]; then
|
||||||
PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info)${reset_color} \$ "
|
PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h$(ip_prompt_info) ${DEFAULT_COLOR}in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info)${reset_color} \$ "
|
||||||
else
|
else
|
||||||
PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info)${reset_color} \$ "
|
PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h$(ip_prompt_info) ${DEFAULT_COLOR}in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info)${reset_color} \$ "
|
||||||
fi
|
fi
|
||||||
PS2='> '
|
PS2='> '
|
||||||
PS4='+ '
|
PS4='+ '
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue