From 8fb4709cbf842ccc29ebf00614063ab279aa22b8 Mon Sep 17 00:00:00 2001 From: Caio Gondim Date: Fri, 6 May 2016 11:21:08 +0200 Subject: [PATCH] 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. --- bullet-train.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 54881b5..8314623 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -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