Skip to content

Commit 75b6a1b

Browse files
author
Jonathan Dahan
committed
Fix quoting for zsh 5.0.0 - thanks @psprint
1 parent 0e061df commit 75b6a1b

File tree

7 files changed

+16
-14
lines changed

7 files changed

+16
-14
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010

1111
### Fixed
1212
- Accidental export of local `fun` variable
13+
- extra "'" in separator for geometry_hg
14+
- Quoting for zsh 5.0.0 - thanks @psprint
1315

1416
## 2.0.2 - 2019-09-04
1517

functions/geometry_git.zsh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ geometry_git_rebase() {
4141
geometry_git_remote() {
4242
local unpushed=${GEOMETRY_GIT_SYMBOL_UNPUSHED:-""}
4343
local unpulled=${GEOMETRY_GIT_SYMBOL_UNPULLED:-""}
44-
local local_commit && local_commit=$(git rev-parse "@" 2>/dev/null)
45-
local remote_commit && remote_commit=$(git rev-parse "@{u}" 2>/dev/null)
44+
local local_commit && local_commit="$(git rev-parse "@" 2>/dev/null)"
45+
local remote_commit && remote_commit="$(git rev-parse "@{u}" 2>/dev/null)"
4646

4747
[[ $local_commit == "@" || $local_commit == $remote_commit ]] && return
4848

49-
local common_base && common_base=$(git merge-base "@" "@{u}" 2>/dev/null) # last common commit
49+
local common_base && common_base="$(git merge-base "@" "@{u}" 2>/dev/null)" # last common commit
5050
[[ $common_base == $remote_commit ]] && echo $unpushed && return
5151
[[ $common_base == $local_commit ]] && echo $unpulled && return
5252

functions/geometry_hg.zsh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ geometry_hg() {
44
(( $+commands[hg] )) || return 1
55
[[ -d .hg ]] || return 2
66

7-
local branch="$(ansi ${GEOMETRY_HG_COLOR_BRANCH:=242} $(hg branch 2> /dev/null))"
7+
local branch="$(ansi ${GEOMETRY_HG_COLOR_BRANCH:=242} "$(hg branch 2> /dev/null)")"
88

99
[[ -n "$(hg status 2> /dev/null)" ]] \
10-
&& local symbol=$(ansi ${GEOMETRY_HG_COLOR_DIRTY:=red} ${GEOMETRY_HG_SYMBOL_DIRTY:=""}) \
11-
|| local symbol=$(ansi ${GEOMETRY_HG_COLOR_CLEAN:=green} ${GEOMETRY_HG_SYMBOL_CLEAN:=""})
10+
&& local symbol="$(ansi ${GEOMETRY_HG_COLOR_DIRTY:=red} ${GEOMETRY_HG_SYMBOL_DIRTY:=""})" \
11+
|| local symbol="$(ansi ${GEOMETRY_HG_COLOR_CLEAN:=green} ${GEOMETRY_HG_SYMBOL_CLEAN:=""})"
1212

13-
echo -n "${branch}${GEOMETRY_HG_SYMBOL_SEPARATOR:='::'}${symbol}"
13+
echo -n "${branch}${GEOMETRY_HG_SYMBOL_SEPARATOR:=::}${symbol}"
1414
}

functions/geometry_kube.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ geometry_kube_symbol() {
44
}
55

66
geometry_kube_namespace() {
7-
local kube_namespace=$(kubectl config view --minify --output "jsonpath={..namespace}" 2> /dev/null)
7+
local kube_namespace="$(kubectl config view --minify --output "jsonpath={..namespace}" 2> /dev/null)"
88
ansi ${GEOMETRY_KUBE_NAMESPACE_COLOR:=default} ${kube_namespace:=default}
99
}
1010

functions/geometry_npm_package_version.zsh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ geometry_npm_package_version() {
77
: ${GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL_COLOR:=red}
88
: ${GEOMETRY_NPM_PACKAGE_VERSION_COLOR:=red}
99

10-
local npm_package_version=$(\grep version package.json | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')
10+
local npm_package_version="$(\grep version package.json | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')"
1111

12-
local symbol=$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL_COLOR $GEOMETRY_NPM_PACKAGE_SYMBOL)
13-
local version=$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_COLOR v$npm_package_version)
12+
local symbol="$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL_COLOR $GEOMETRY_NPM_PACKAGE_SYMBOL)"
13+
local version="$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_COLOR v$npm_package_version)"
1414
echo -n $symbol $version
1515
}

functions/geometry_rust_version.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
geometry_rust_version() {
44
{ test -f Cargo.toml || ls -1 '*rs' 2>/dev/null; } || return 1
55

6-
local rust_version=$(rustc --version | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')
6+
local rust_version="$(rustc --version | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')"
77

88
ansi ${GEOMETRY_RUST_VERSION_COLOR:=red} v$rust_version
99
}

functions/geometry_status.zsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ geometry_status() {
1616
colors=(${GEOMETRY_STATUS_SYMBOL_COLOR_HASH_COLORS})
1717
fi
1818

19-
local sum=0; for c in ${(s::)^HOST}; do ((sum += $(print -f '%d' "'$c"))); done
19+
local sum=0; for c in ${(s::)^HOST}; do ((sum += "$(print -f '%d' "'$c")")); done
2020

21-
local index=$(($sum % ${#colors}))
21+
local index="$(($sum % ${#colors}))"
2222

2323
[[ "$index" -eq 0 ]] && index=1
2424

0 commit comments

Comments
 (0)