Restructuring build flows to choose user as default but be overridable
This commit is contained in:
10
itdominator-base-image/env/.bash_ps1
vendored
10
itdominator-base-image/env/.bash_ps1
vendored
@@ -7,11 +7,17 @@ function prompt_command() {
|
||||
_COMMAND="parts = '$(pwd)'.split('/'); print('$(pwd)') if not len(parts) > 3 else print(f'.../{parts[-3]}/{parts[-2]}/{parts[-1]}')"
|
||||
_PATH=$(python <<< "${_COMMAND}" || pwd)
|
||||
_BRANCH="$(git rev-parse --symbolic-full-name --abbrev-ref HEAD 2>/dev/null)"
|
||||
_CURRENT_HOUR=$(date +%H)
|
||||
|
||||
printf '\033]7;file://%s%s\007' "$PWD"
|
||||
|
||||
# Week Day/Month/Day : Time -- user@group -- current dir path -- git branch
|
||||
PS1="\[\e[32m\]\d\[\e[m\]: \[\e[36m\]\@\[\e[m\] -- \[\e[31m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\] -- \[\e[35m\]${_PATH}\[\e[m\] -- ${_BRANCH} \\$ "
|
||||
if (( 10#$_CURRENT_HOUR > 8 && 10#$_CURRENT_HOUR < 20 )); then
|
||||
PS1="\[\e[32m\]\d\[\e[m\]: \[\e[36m\]\@\[\e[m\] -- \[\e[31m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\] -- \[\e[35m\]${_PATH}\[\e[m\] -- ${_BRANCH} \\$ "
|
||||
else
|
||||
PS1="\[\e[32m\]\d\[\e[m\] -- \[\e[31m\]\u\[\e[m\]@\[\e[31m\]\h\[\e[m\] -- \[\e[35m\]${_PATH}\[\e[m\] -- ${_BRANCH} \\$ "
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
export PROMPT_COMMAND=prompt_command
|
||||
|
||||
Reference in New Issue
Block a user