Skip to content

Instantly share code, notes, and snippets.

@avoidik
Created July 2, 2021 20:28
Show Gist options
  • Save avoidik/00b323c9426dfc2e029f4b58faf99b1a to your computer and use it in GitHub Desktop.
Save avoidik/00b323c9426dfc2e029f4b58faf99b1a to your computer and use it in GitHub Desktop.
powerline-go configuration
INTERACTIVE_BASHPID_TIMER="/tmp/${USER}.START.$$"
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
function _update_ps1() {
local __ERRCODE=$?
local __JOBS=$(jobs -p | wc -l)
local __DURATION=0
if [ -e $INTERACTIVE_BASHPID_TIMER ]; then
local __END=$SECONDS
local __START=$(cat "$INTERACTIVE_BASHPID_TIMER")
__DURATION="$(($__END - ${__START:-__END}))"
rm -f "$INTERACTIVE_BASHPID_TIMER"
fi
PS1="$(powerline-go -cwd-max-depth 3 -hostname-only-if-ssh -numeric-exit-codes -modules time,venv,kube,cwd,perms,git,jobs,exit,duration -duration-min 10 -duration $__DURATION $__ERRCODE -shell bash)"
}
if [ "$TERM" != "linux" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment