Rearranged runtime functions
This commit is contained in:
parent
2ecab18181
commit
d3f7e2c155
30
liquidprompt
30
liquidprompt
@ -1336,25 +1336,8 @@ _lp_runtime()
|
|||||||
fi
|
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()
|
_lp_reset_runtime()
|
||||||
{
|
{
|
||||||
if $_LP_SHELL_zsh; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Compute number of seconds since program was started
|
# Compute number of seconds since program was started
|
||||||
_LP_RUNTIME_SECONDS=$((SECONDS - _LP_RUNTIME_LAST_SECONDS))
|
_LP_RUNTIME_SECONDS=$((SECONDS - _LP_RUNTIME_LAST_SECONDS))
|
||||||
|
|
||||||
@ -1369,8 +1352,21 @@ _lp_reset_runtime()
|
|||||||
|
|
||||||
if [ "$LP_ENABLE_RUNTIME" = 1 ]
|
if [ "$LP_ENABLE_RUNTIME" = 1 ]
|
||||||
then
|
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
|
# _lp_reset_runtime gets called whenever bash executes a command
|
||||||
trap '_lp_reset_runtime' DEBUG
|
trap '_lp_reset_runtime' DEBUG
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
Loading…
Reference in New Issue
Block a user