.
This commit is contained in:
parent
4c7cdca4fa
commit
9d30a4672d
@ -1,4 +1,17 @@
|
||||
#!/bin/bash
|
||||
function fetch_bash_ps1(){
|
||||
local BASH_PS1_URL="${BASH_PS1_URL:-https://git.rre.nu/jonas/dotfiles/src/branch/master/.functions/ps1.sh}"
|
||||
|
||||
if ! command -v curl &> /dev/null;then
|
||||
echo "curl not found"
|
||||
return 1
|
||||
fi
|
||||
curl -o "${HOME}/.functions/ps1.sh" "$BASH_PS1_URL"
|
||||
# shellcheck disable=1090
|
||||
source "${HOME}/.functions/ps1.sh"
|
||||
|
||||
}
|
||||
|
||||
function bash_ps1 () {
|
||||
local LAST_EXIT_STATUS=$?
|
||||
local EXIT_STATUS=""
|
||||
@ -28,7 +41,12 @@ function bash_ps1 () {
|
||||
export GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||
|
||||
[[ $LAST_EXIT_STATUS != 0 ]] && EXIT_STATUS="${PS1_COLOR_DIVIDER}[${PS1_COLOR_EXIT_STATUS}${LAST_EXIT_STATUS}${PS1_COLOR_DIVIDER}]"
|
||||
[[ $(type -t __git_ps1) == function ]] && GIT_BRANCH="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_GITBRANCH}$(__git_ps1 '%s')${PS1_COLOR_DIVIDER}]"
|
||||
if [[ $(type -t __git_ps1) == function ]];then
|
||||
GIT_BRANCH="$(__git_ps1 '%s')"
|
||||
if [[ -n "$GIT_BRANCH" ]];then
|
||||
GIT_BRANCH="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_GITBRANCH}${GIT_BRANCH}${PS1_COLOR_DIVIDER}]"
|
||||
fi
|
||||
fi
|
||||
[[ -n "$VIRTUAL_ENV" ]] && PYTHON_ENV="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_VENV}${VIRTUAL_ENV##*/}${PS1_COLOR_DIVIDER}]"
|
||||
if [[ $(type kubectl) ]]; then
|
||||
CURRENT_CONTEXT="$(kubectl config current-context)"
|
||||
|
Loading…
Reference in New Issue
Block a user