Rearranged runtime functions
This commit is contained in:
parent
2ecab18181
commit
d3f7e2c155
34
liquidprompt
34
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,8 +1352,21 @@ _lp_reset_runtime()
|
||||
|
||||
if [ "$LP_ENABLE_RUNTIME" = 1 ]
|
||||
then
|
||||
# _lp_reset_runtime gets called whenever bash executes a command
|
||||
trap '_lp_reset_runtime' DEBUG
|
||||
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
|
||||
|
||||
###############
|
||||
|
Loading…
Reference in New Issue
Block a user