Skip to content

Commit a0b598f

Browse files
author
Jonathan Dahan
committed
inline time variables
1 parent 8ca8b0a commit a0b598f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

functions/geometry_git.zsh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ geometry_git_stashes() {
66
}
77

88
geometry_git_time() {
9-
local last_commit
10-
local now
11-
local seconds_since_last_commit
12-
last_commit=$(git log -1 --pretty=format:'%at' 2> /dev/null)
9+
local last_commit; last_commit=$(git log -1 --pretty=format:'%at' 2> /dev/null)
1310

14-
[[ -z "$last_commit" ]] && ansi ${GEOMETRY_COLOR_NO_TIME:-default} ${GEOMETRY_GIT_NO_COMMITS_MESSAGE:-no-commits} && return
11+
[[ -z "$last_commit" ]] && ansi ${GEOMETRY_COLOR_NO_TIME:-default} ${GEOMETRY_GIT_NO_COMMITS_MESSAGE:-welcome} && return
1512

16-
now=$(date +%s)
17-
seconds_since_last_commit=$((now - last_commit))
13+
local now; now=$(date +%s)
14+
local seconds_since_last_commit; seconds_since_last_commit=$((now - last_commit))
1815
geometry::time $seconds_since_last_commit ${GEOMETRY_GIT_TIME_DETAILED:-false}
1916
}
2017

0 commit comments

Comments
 (0)