fix: Fix PROMPT_COMMAND management
This commit is contained in:
parent
fe6642402b
commit
66c57a0a51
9
libs/path.bash
Normal file
9
libs/path.bash
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
_path_add() {
|
||||||
|
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
|
||||||
|
PATH="${PATH:+"$PATH:"}$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Source : https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
|
9
libs/prompt_command.bash
Normal file
9
libs/prompt_command.bash
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
_prompt_command_add() {
|
||||||
|
if [ -n "$1" ] && [[ ":$PROMPT_COMMAND:" != *":$1:"* ]]; then
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND:+"$PROMPT_COMMAND:"}$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
export PROMPT_COMMAND
|
@ -13,7 +13,7 @@ if [ "${POWERLINE}" = "powerline-go" ]; then
|
|||||||
PS1=$($POWERLINE -jobs "$(jobs -p | wc -l)" -error $? -modules "ssh,host,wsl,user,cwd,direnv,venv,perms,git,jobs,exit,root" -modules-right "docker,docker-context,kube,terraform-workspace,termtitle" -newline)
|
PS1=$($POWERLINE -jobs "$(jobs -p | wc -l)" -error $? -modules "ssh,host,wsl,user,cwd,direnv,venv,perms,git,jobs,exit,root" -modules-right "docker,docker-context,kube,terraform-workspace,termtitle" -newline)
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$TERM" != "linux" ]; then PROMPT_COMMAND="$PROMPT_COMMAND; _update_ps1"; fi
|
if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_ps1" ; fi
|
||||||
|
|
||||||
elif [ "${POWERLINE}" = "powerline" ]; then
|
elif [ "${POWERLINE}" = "powerline" ]; then
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user