Prepend leaking global variable with BULLETTRAIN_

We should avoid as much as possible to use globals.
If not possible, let's at least prepend it with the `BULLETTRAIN_`
namespace to be explicit that this variable belongs to this project.
This commit is contained in:
Caio Gondim
2016-05-06 11:21:08 +02:00
parent 731c4814a7
commit 8fb4709cbf

View File

@@ -364,14 +364,14 @@ precmd() {
local stop=`date +%s`
local start=${cmd_timestamp:-$stop}
let elapsed=$stop-$start
let BULLETTRAIN_last_exec_duration=$stop-$start
cmd_timestamp=''
}
prompt_cmd_exec_time() {
[[ $BULLETTRAIN_EXEC_TIME_SHOW == false ]] && return
[ $elapsed -gt $BULLETTRAIN_EXEC_TIME_ELAPSED ] && prompt_segment $BULLETTRAIN_EXEC_TIME_BG $BULLETTRAIN_EXEC_TIME_FG "${elapsed}s"
[ $BULLETTRAIN_last_exec_duration -gt $BULLETTRAIN_EXEC_TIME_ELAPSED ] && prompt_segment $BULLETTRAIN_EXEC_TIME_BG $BULLETTRAIN_EXEC_TIME_FG "${BULLETTRAIN_last_exec_duration}s"
}
# Custom