Rearranged runtime functions
This commit is contained in:
parent
2ecab18181
commit
d3f7e2c155
30
liquidprompt
30
liquidprompt
@ -1336,25 +1336,8 @@ _lp_runtime()
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$_LP_SHELL_zsh" ] ; then
|
||||
function precmd() {
|
||||
if [ $timer ]; then
|
||||
export _LP_RUNTIME_SECONDS=$(($SECONDS - $timer))
|
||||
unset timer
|
||||
fi
|
||||
}
|
||||
|
||||
function preexec() {
|
||||
export timer=${timer:-$SECONDS}
|
||||
}
|
||||
fi
|
||||
|
||||
_lp_reset_runtime()
|
||||
{
|
||||
if $_LP_SHELL_zsh; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Compute number of seconds since program was started
|
||||
_LP_RUNTIME_SECONDS=$((SECONDS - _LP_RUNTIME_LAST_SECONDS))
|
||||
|
||||
@ -1369,9 +1352,22 @@ _lp_reset_runtime()
|
||||
|
||||
if [ "$LP_ENABLE_RUNTIME" = 1 ]
|
||||
then
|
||||
if "$_LP_SHELL_zsh"; then
|
||||
function precmd() {
|
||||
if [ $timer ]; then
|
||||
export _LP_RUNTIME_SECONDS=$(($SECONDS - $timer))
|
||||
unset timer
|
||||
fi
|
||||
}
|
||||
|
||||
function preexec() {
|
||||
export timer=${timer:-$SECONDS}
|
||||
}
|
||||
else
|
||||
# _lp_reset_runtime gets called whenever bash executes a command
|
||||
trap '_lp_reset_runtime' DEBUG
|
||||
fi
|
||||
fi
|
||||
|
||||
###############
|
||||
# System load #
|
||||
|
Loading…
Reference in New Issue
Block a user