Skip to content

Commit 0f82c56

Browse files
author
jedahan
committed
fix geometry_status and geometry_exitcode
1 parent 1094406 commit 0f82c56

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

Diff for: functions/geometry_exitcode

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# geometry_exitcode - show the exit code of the last status
22

3-
(( $GEOMETRY[LAST_STATUS] )) && ansi ${GEOMETRY_EXITCODE_COLOR:-red} $GEOMETRY[LAST_STATUS] || echo ''
3+
(( $GEOMETRY_STATUS )) && ansi ${GEOMETRY_EXITCODE_COLOR:-red} $GEOMETRY_STATUS

Diff for: functions/geometry_status

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# geometry_status - show a symbol with error/success and root/non-root information
22

3-
local root; [[ $UID = 0 || $EUID = 0 ]] && root=true || root=false
4-
local error; (( $GEOMETRY[LAST_STATUS] )) && error=true || error=false
3+
(( $GEOMETRY_STATUS )) && error=true || error=false
4+
[[ $UID = 0 || $EUID = 0 ]] && root=true || root=false
55

6-
local color=${GEOMETRY_STATUS_COLOR:-default}
6+
( $error ) && color=${GEOMETRY_STATUS_COLOR_ERROR:-red} || color=${GEOMETRY_STATUS_COLOR:-default}
77

8-
if ( $error );
9-
then
10-
color=${GEOMETRY_STATUS_COLOR_ERROR:-red};
11-
fi
8+
( ! $root && ! $error ) && symbol=${GEOMETRY_STATUS_SYMBOL:-▲}
9+
( ! $root && $error ) && symbol=${GEOMETRY_STATUS_SYMBOL_ERROR:-△}
10+
( $root && ! $error ) && symbol=${GEOMETRY_STATUS_SYMBOL_ROOT:-▼}
11+
( $root && $error ) && symbol=${GEOMETRY_STATUS_SYMBOL_ROOT_ERROR:=▽}
1212

13-
( $root && $error ) && ansi $color ${GEOMETRY_STATUS_SYMBOL_ROOT_ERROR:=▽} && return
14-
( $root ) && ansi $color ${GEOMETRY_STATUS_SYMBOL_ROOT:-▼} && return
15-
( $error ) && ansi $color ${GEOMETRY_STATUS_SYMBOL_ERROR:-△} && return
16-
ansi $color ${GEOMETRY_STATUS_SYMBOL:-▲}
13+
ansi $color $symbol

Diff for: geometry.zsh

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# pure: https://github.com/sindresorhus/pure
55
# mnml: https://github.com/subnixr/minimal
66

7-
builtin typeset -gA GEOMETRY; GEOMETRY[ROOT]=${0:A:h}
7+
builtin typeset -gA GEOMETRY
88

99
(($+GEOMETRY_PROMPT)) || GEOMETRY_PROMPT=(geometry_echo geometry_status geometry_path)
1010
(($+GEOMETRY_RPROMPT)) || GEOMETRY_RPROMPT=(geometry_git geometry_hg geometry_jj geometry_echo)
@@ -14,7 +14,7 @@ builtin typeset -gA GEOMETRY; GEOMETRY[ROOT]=${0:A:h}
1414

1515
builtin autoload -U add-zsh-hook
1616

17-
fpath+=("${GEOMETRY[ROOT]}"/functions)
17+
fpath+=("${0:A:h}"/functions)
1818
autoload -Uz \
1919
geometry_last_command \
2020
geometry_docker_machine \
@@ -130,8 +130,7 @@ geometry::rprompt() {
130130
}
131131

132132
geometry::prompt() {
133-
PROMPT=""
134-
GEOMETRY[LAST_STATUS]="$status"
133+
export GEOMETRY_STATUS=$status
135134
PROMPT=" $(geometry::wrap $PWD $GEOMETRY_PROMPT) "
136135
}
137136

0 commit comments

Comments
 (0)