mirror of
https://github.com/kastdeur/dotfiles.git
synced 2024-12-22 01:03:35 +01:00
[bash] env STATICPS1 now toggles PS1 prompt_command
This commit is contained in:
parent
fd86e1cd6d
commit
eeb2f10d2d
1 changed files with 36 additions and 26 deletions
|
@ -5,6 +5,9 @@
|
||||||
SHORTPS1=${SHORTPS1:-}
|
SHORTPS1=${SHORTPS1:-}
|
||||||
export SHORTPS1
|
export SHORTPS1
|
||||||
|
|
||||||
|
STATICPS1=${STATICPS1:-}
|
||||||
|
export STATICPS1
|
||||||
|
|
||||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||||
# off by default to not distract the user: the focus in a terminal window
|
# off by default to not distract the user: the focus in a terminal window
|
||||||
# should be on the output of commands, not on the prompt
|
# should be on the output of commands, not on the prompt
|
||||||
|
@ -117,6 +120,7 @@ function __colored_username() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __prompt_command() {
|
function __prompt_command() {
|
||||||
|
local STATIC_PS1="${1:-${STATICPS1}}"
|
||||||
local RETVAL=$?
|
local RETVAL=$?
|
||||||
if [ ! $RETVAL -ne 0 ]; then
|
if [ ! $RETVAL -ne 0 ]; then
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
@ -124,23 +128,26 @@ function __prompt_command() {
|
||||||
|
|
||||||
PS1="${debian_chroot:+($debian_chroot)}"
|
PS1="${debian_chroot:+($debian_chroot)}"
|
||||||
|
|
||||||
#Return Value
|
if [ -z "${STATIC_PS1}" ]; then
|
||||||
if [ -n $RETVAL ]; then
|
### Add Return Value ###
|
||||||
PS1+="$(retval ${RETVAL})"
|
if [ -n $RETVAL ]; then
|
||||||
fi
|
PS1+="$(retval ${RETVAL})"
|
||||||
|
fi
|
||||||
|
|
||||||
### Add amount of jobs ###
|
### Add amount of jobs ###
|
||||||
if true; then
|
if true; then
|
||||||
PS1+="$(jobscount)"
|
PS1+="$(jobscount)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Add Git Status ###
|
### Add Git Status ###
|
||||||
if [[ $(command -v git) ]]; then
|
if [[ $(command -v git) ]]; then
|
||||||
PS1+="$(git_status) "
|
PS1+="$(git_status)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PS1+=" "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# user@hostname
|
||||||
#user@hostname
|
|
||||||
if color ; then
|
if color ; then
|
||||||
PS1+="$(__colored_username)"
|
PS1+="$(__colored_username)"
|
||||||
else
|
else
|
||||||
|
@ -155,7 +162,7 @@ function __prompt_command() {
|
||||||
PS1+="\h"
|
PS1+="\h"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#time w/ seconds
|
# time w/ seconds
|
||||||
if color ; then
|
if color ; then
|
||||||
PS1+="${Yel}${On_Bla}"
|
PS1+="${Yel}${On_Bla}"
|
||||||
fi
|
fi
|
||||||
|
@ -165,26 +172,29 @@ function __prompt_command() {
|
||||||
if color ; then
|
if color ; then
|
||||||
PS1+="${RCol}"
|
PS1+="${RCol}"
|
||||||
fi
|
fi
|
||||||
PS1+=" "
|
|
||||||
#dir count, pwd
|
|
||||||
if color ; then
|
|
||||||
PS1+="${BBlu}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PS1+="\[$(ls |wc -l)\]@\W"
|
# dir count, pwd
|
||||||
|
if [ -z "${STATIC_PS1}" ]; then
|
||||||
|
PS1+=" "
|
||||||
|
if color ; then
|
||||||
|
PS1+="${BBlu}"
|
||||||
|
fi
|
||||||
|
|
||||||
if color ; then
|
PS1+="\[$(ls |wc -l)\]@\W"
|
||||||
PS1+="${RCol}"
|
|
||||||
|
if color ; then
|
||||||
|
PS1+="${RCol}"
|
||||||
|
fi
|
||||||
|
PS1+=" "
|
||||||
fi
|
fi
|
||||||
PS1+=" "
|
## Short prompt
|
||||||
## Short prompt
|
|
||||||
if [ -n "${SHORTPS1}" ]; then
|
if [ -n "${SHORTPS1}" ]; then
|
||||||
PS1+="\r\n"
|
PS1+="\r\n"
|
||||||
fi
|
fi
|
||||||
#UID
|
# UID
|
||||||
PS1+=':\$ '
|
PS1+=':\$ '
|
||||||
|
|
||||||
# Something for VTE
|
# Something for VTE
|
||||||
PS1+=$(vte_thing)
|
PS1+=$(vte_thing)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue