File tree 21 files changed +162
-194
lines changed
21 files changed +162
-194
lines changed Original file line number Diff line number Diff line change 3
3
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
4
4
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
5
5
6
- ## Unreleased
6
+ # Unreleased
7
+
8
+ ## 3.0.0 - 2025-01-06
9
+
10
+ Years later, we are back. Many bugfixes and small annoyances and incompatibilities gone. A few breaking changes.
11
+
12
+ Removed geometry_exec_time, will re-add after a future refactor.
13
+
14
+ GEOMETRY_INFO now uses zsh statusline instead of being an empty command alias.
15
+
16
+ ### Added
17
+ - Add geometry_jj function for jujutsu
7
18
- Add GEOMETRY_TITLE and GEOMETRY_CMDTITLE as display locations
8
19
- Add geometry_cmd function to display currently-running command in GEOMETRY_CMDTITLE
9
20
21
+ ### Removed
22
+ - Removed geometry_exec_time
23
+
10
24
### Fixed
25
+ - Fix initial terminal RPROMPT being blank
26
+ - Fix showing stale information in RPROMPT
27
+ - Fix extra newline when printing GEOMETRY_INFO
11
28
- Fix git functions erroring out in non-git directories (thanks @duncanbeevers !)
12
29
- Git conflict counting with multiple files (thanks @gluxon !)
13
30
- Fix git_status when the git directory contains spaces (thanks @tanyaionova !)
14
- - Do not print newline on enter if GEOMETRY_INFO is empty
31
+ - Fix compatibility with znap (thanks @cweagans )
32
+
33
+ ### Changed
34
+ - Manually autoload functions we ship, to avoid loading user-created files
35
+ - Prefix some functions with ` builtin ` to avoid user-defined aliases and functions
36
+
37
+ ---
38
+
39
+ # Released
15
40
16
41
## 2.2.0 - 2020-01-13
17
42
Original file line number Diff line number Diff line change 1
1
# geometry_docker_machine - show the current docker machine name
2
2
3
- geometry_docker_machine() {
4
- [[ -n $DOCKER_MACHINE_NAME ]] || return
5
-
6
- ansi ${GEOMETRY_DOCKER_MACHINE_COLOR:=blue} "(${GEOMETRY_DOCKER_MACHINE_SYMBOL:="⚓"} ${DOCKER_MACHINE_NAME})"
7
- }
3
+ [[ -n $DOCKER_MACHINE_NAME ]] || return
4
+ ansi ${GEOMETRY_DOCKER_MACHINE_COLOR:=blue} "(${GEOMETRY_DOCKER_MACHINE_SYMBOL:="⚓"} ${DOCKER_MACHINE_NAME})"
Original file line number Diff line number Diff line change 1
1
# geometry_echo - simple echo for a balanced terminal
2
2
3
- geometry_echo() { echo -n ${GEOMETRY_ECHO:-''}; }
3
+ echo -n ${GEOMETRY_ECHO:-''}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
# geometry_exitcode - show the exit code of the last status
2
2
3
- geometry_exitcode() {
4
- (( $GEOMETRY[LAST_STATUS] )) && ansi ${GEOMETRY_EXITCODE_COLOR:-red} $GEOMETRY[LAST_STATUS] || echo ''
5
- }
3
+ (( $GEOMETRY[LAST_STATUS] )) && ansi ${GEOMETRY_EXITCODE_COLOR:-red} $GEOMETRY[LAST_STATUS] || echo ''
Original file line number Diff line number Diff line change @@ -84,24 +84,21 @@ geometry_git_conflicts() {
84
84
ansi ${GEOMETRY_GIT_COLOR_CONFLICTS_UNSOLVED:-red} "${GEOMETRY_GIT_SYMBOL_CONFLICTS_UNSOLVED:-'◈'} $count"
85
85
}
86
86
87
- geometry_git() {
88
- (( $+commands[git] )) || return
89
-
90
- _geometry_git_guard || return
91
-
92
- $(git rev-parse --is-bare-repository) \
93
- && ansi ${GEOMETRY_GIT_COLOR_BARE:=blue} ${GEOMETRY_GIT_SYMBOL_BARE:="⬢"} \
94
- && return
95
-
96
- local git_info && git_info=(
97
- geometry_git_rebase
98
- geometry_git_remote
99
- geometry_git_branch
100
- geometry_git_conflicts
101
- geometry_git_time
102
- geometry_git_stashes
103
- geometry_git_status
104
- )
105
-
106
- geometry::wrap $PWD $git_info
107
- }
87
+ (( $+commands[git] )) || return
88
+ _geometry_git_guard || return
89
+
90
+ $(git rev-parse --is-bare-repository) \
91
+ && ansi ${GEOMETRY_GIT_COLOR_BARE:=blue} ${GEOMETRY_GIT_SYMBOL_BARE:="⬢"} \
92
+ && return
93
+
94
+ local git_info && git_info=(
95
+ geometry_git_rebase
96
+ geometry_git_remote
97
+ geometry_git_branch
98
+ geometry_git_conflicts
99
+ geometry_git_time
100
+ geometry_git_stashes
101
+ geometry_git_status
102
+ )
103
+
104
+ geometry::wrap $PWD $git_info
Original file line number Diff line number Diff line change 1
1
# geometry_hg - display current mercurial branch and status
2
2
3
- geometry_hg() {
4
- (( $+commands[hg] )) || return 1
5
- [[ -d .hg ]] || return 2
3
+ (( $+commands[hg] )) || return 1
4
+ [[ -d .hg ]] || return 2
6
5
7
- local branch="$(ansi ${GEOMETRY_HG_COLOR_BRANCH:=242} "$(hg branch 2> /dev/null)")"
6
+ local branch="$(ansi ${GEOMETRY_HG_COLOR_BRANCH:=242} "$(hg branch 2> /dev/null)")"
8
7
9
- [[ -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:="⬢"})"
8
+ [[ -n "$(hg status 2> /dev/null)" ]] \
9
+ && local symbol="$(ansi ${GEOMETRY_HG_COLOR_DIRTY:=red} ${GEOMETRY_HG_SYMBOL_DIRTY:="⬡"})" \
10
+ || local symbol="$(ansi ${GEOMETRY_HG_COLOR_CLEAN:=green} ${GEOMETRY_HG_SYMBOL_CLEAN:="⬢"})"
12
11
13
- echo -n "${branch}${GEOMETRY_HG_SYMBOL_SEPARATOR:=::}${symbol}"
14
- }
12
+ echo -n "${branch}${GEOMETRY_HG_SYMBOL_SEPARATOR:=::}${symbol}"
Original file line number Diff line number Diff line change 1
1
# geometry_hostname - show user@hostname
2
2
3
- geometry_hostname() {
4
- local _host=${HOST:-$HOSTNAME}
5
- [[ "$_host" = "${GEOMETRY_HOSTNAME_HIDE_ON:-localhost}" ]] && return
6
- echo -n "${USER}${GEOMETRY_HOSTNAME_SEPARATOR:-@}${_host}"
7
- }
3
+ local _host=${HOST:-$HOSTNAME}
4
+ [[ "$_host" = "${GEOMETRY_HOSTNAME_HIDE_ON:-localhost}" ]] && return
5
+ echo -n "${USER}${GEOMETRY_HOSTNAME_SEPARATOR:-@}${_host}"
Original file line number Diff line number Diff line change 1
1
# geometry_jj - display current jujutsu status
2
2
3
- geometry_jj () {
4
- (( $+commands[jj] )) || return 1
5
- jj log --quiet --no-pager --no-graph --ignore-working-copy --revisions @ --color never --template \
6
- ${GEOMETRY_JJ_TEMPLATE:-'"%F{5}" ++ change_id.shortest() ++ "%F{4}" ++ commit_id.shortest() ++ "%f% "'} \
7
- 2> /dev/null
8
- }
3
+ (( $+commands[jj] )) || return 1
4
+ jj log --quiet --no-pager --no-graph --ignore-working-copy --revisions @ --color never --template \
5
+ ${GEOMETRY_JJ_TEMPLATE:-'"%F{5}" ++ change_id.shortest() ++ "%F{4}" ++ commit_id.shortest() ++ "%f% "'} \
6
+ 2> /dev/null
Original file line number Diff line number Diff line change 1
1
# geometry_jobs - show background jobs count `⚙ 1`
2
2
3
- geometry_jobs() { [[ 0 -ne "$(jobs | wc -l)" ]] && ansi ${GEOMETRY_JOBS_COLOR:=blue} '%(1j.'${GEOMETRY_JOBS_SYMBOL:="⚙"}' %j.)'; }
3
+ [[ 0 -ne "$(jobs | wc -l)" ]] && ansi ${GEOMETRY_JOBS_COLOR:=blue} '%(1j.'${GEOMETRY_JOBS_SYMBOL:="⚙"}' %j.)'
Original file line number Diff line number Diff line change @@ -19,20 +19,18 @@ geometry_kube_version() {
19
19
ansi ${GEOMETRY_KUBE_VERSION_COLOR:=default} ${kube_version:=default}
20
20
}
21
21
22
- geometry_kube() {
23
- (( $+commands[kubectl] )) || return
22
+ (( $+commands[kubectl] )) || return
24
23
25
- ( ${GEOMETRY_KUBE_PIN:=true} ) || return
24
+ ( ${GEOMETRY_KUBE_PIN:=true} ) || return
26
25
27
- ( ${GEOMETRY_KUBE_PIN:=false} ) || [[ -n "$KUBECONFIG" ]] || [[ -n "$(kubectl config current-context 2> /dev/null)" ]] || return
26
+ ( ${GEOMETRY_KUBE_PIN:=false} ) || [[ -n "$KUBECONFIG" ]] || [[ -n "$(kubectl config current-context 2> /dev/null)" ]] || return
28
27
29
- local geometry_kube_details && geometry_kube_details=(
30
- $(geometry_kube_symbol)
31
- $(geometry_kube_context)
32
- $(geometry_kube_namespace)
33
- $(geometry_kube_version)
34
- )
28
+ local geometry_kube_details && geometry_kube_details=(
29
+ $(geometry_kube_symbol)
30
+ $(geometry_kube_context)
31
+ $(geometry_kube_namespace)
32
+ $(geometry_kube_version)
33
+ )
35
34
36
- local separator=${GEOMETRY_KUBE_SEPARATOR:-"|"}
37
- echo -n ${(pj.$separator.)geometry_kube_details}
38
- }
35
+ local separator=${GEOMETRY_KUBE_SEPARATOR:-"|"}
36
+ echo -n ${(pj.$separator.)geometry_kube_details}
Original file line number Diff line number Diff line change 1
1
# geometry_newline - add to the end of GEOMETRY_PROMPT to get a 2-line prompt!
2
2
3
- geometry_newline() { echo "\n\0"; }
3
+ echo "\n\0"
Original file line number Diff line number Diff line change 1
1
# geometry_node - show node and npm/yarm version when in a node project context
2
2
3
- geometry_node() {
4
- (( $+commands[node] )) || return
3
+ (( $+commands[node] )) || return
5
4
6
- test -n "$GEOMETRY_NODE_PIN" || test -f package.json || test -f yarn.lock || return 1
5
+ test -n "$GEOMETRY_NODE_PIN" || test -f package.json || test -f yarn.lock || return 1
7
6
8
- GEOMETRY_NODE=$(ansi ${GEOMETRY_NODE_COLOR:=green} ${GEOMETRY_NODE_SYMBOL="⬡"})
7
+ GEOMETRY_NODE=$(ansi ${GEOMETRY_NODE_COLOR:=green} ${GEOMETRY_NODE_SYMBOL="⬡"})
9
8
10
- local package_manager=npm
9
+ local package_manager=npm
11
10
12
- (( $+commands[yarn] )) && [[ -f yarn.lock ]] && package_manager=yarn
11
+ (( $+commands[yarn] )) && [[ -f yarn.lock ]] && package_manager=yarn
13
12
14
- local packager_version="$($package_manager --version 2>/dev/null)"
15
- local node_version="$(node -v 2>/dev/null)"
16
- echo -n "$GEOMETRY_NODE $node_version ($package_manager:$packager_version)"
17
- }
13
+ local packager_version="$($package_manager --version 2>/dev/null)"
14
+ local node_version="$(node -v 2>/dev/null)"
15
+ echo -n "$GEOMETRY_NODE $node_version ($package_manager:$packager_version)"
Original file line number Diff line number Diff line change 1
1
# geometry_npm_package_version - display the current folder's npm package version from package.json (by @drager)
2
2
3
- geometry_npm_package_version() {
4
- [[ -f package.json ]] || return 1
5
-
6
- : ${GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL:="📦"}
7
- : ${GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL_COLOR:=red}
8
- : ${GEOMETRY_NPM_PACKAGE_VERSION_COLOR:=red}
9
-
10
- local npm_package_version="$(\grep version package.json | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')"
11
-
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)"
14
- echo -n $symbol $version
15
- }
3
+ [[ -f package.json ]] || return 1
4
+
5
+ : ${GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL:="📦"}
6
+ : ${GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL_COLOR:=red}
7
+ : ${GEOMETRY_NPM_PACKAGE_VERSION_COLOR:=red}
8
+
9
+ local npm_package_version="$(\grep version package.json | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')"
10
+
11
+ local symbol="$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_SYMBOL_COLOR $GEOMETRY_NPM_PACKAGE_SYMBOL)"
12
+ local version="$(ansi $GEOMETRY_NPM_PACKAGE_VERSION_COLOR v$npm_package_version)"
13
+ echo -n $symbol $version
Original file line number Diff line number Diff line change 1
1
# geometry_path - show the current path
2
2
3
- geometry_path() {
4
- local dir=${GEOMETRY_PATH_SYMBOL_HOME:-"%$GEOMETRY_PATH_TRUNCATE~"} # symbol representing the home directory
5
- ( ${GEOMETRY_PATH_SHOW_BASENAME:-false} ) && dir=${PWD:t}
6
- ansi ${GEOMETRY_PATH_COLOR:-blue} $dir
7
- }
3
+ # symbol representing the home directory
4
+ dir=${GEOMETRY_PATH_SYMBOL_HOME:-"%$GEOMETRY_PATH_TRUNCATE~"}
5
+ ( ${GEOMETRY_PATH_SHOW_BASENAME:-false} ) && dir=${PWD:t}
6
+ ansi ${GEOMETRY_PATH_COLOR:-blue} $dir
Original file line number Diff line number Diff line change 1
1
# geometry_ruby - display the current ruby version, rvm version, and gemset
2
2
3
- geometry_ruby() {
4
- (( $+commands[ruby] )) || return
3
+ (( $+commands[ruby] )) || return
5
4
6
- GEOMETRY_RUBY=$(ansi ${GEOMETRY_RUBY_COLOR:=default} ${GEOMETRY_RUBY_SYMBOL:="◆"})
5
+ GEOMETRY_RUBY=$(ansi ${GEOMETRY_RUBY_COLOR:=default} ${GEOMETRY_RUBY_SYMBOL:="◆"})
7
6
8
- [[ $(ruby -v) =~ 'ruby ([0-9a-zA-Z.]+)' ]]
9
- local ruby_version=$match[1]
7
+ [[ $(ruby -v) =~ 'ruby ([0-9a-zA-Z.]+)' ]]
8
+ local ruby_version=$match[1]
10
9
11
- (( $+commands[rvm] )) && {
12
- [[ $(rvm -v) =~ 'rvm ([0-9a-zA-Z.]+)' ]]
13
- local rvm_version=$match[1]
10
+ (( $+commands[rvm] )) && {
11
+ [[ $(rvm -v) =~ 'rvm ([0-9a-zA-Z.]+)' ]]
12
+ local rvm_version=$match[1]
14
13
15
14
16
- ( ${GEOMETRY_RUBY_RVM_SHOW_GEMSET:=true} ) && {
17
- [[ $(rvm current) =~ 'ruby-[0-9.]+@?(.*)' ]]
18
- local gemset=${match[1]:-"default"}
19
- }
15
+ ( ${GEOMETRY_RUBY_RVM_SHOW_GEMSET:=true} ) && {
16
+ [[ $(rvm current) =~ 'ruby-[0-9.]+@?(.*)' ]]
17
+ local gemset=${match[1]:-"default"}
20
18
}
21
-
22
- echo -n "${(j: :):-$GEOMETRY_RUBY $ruby_version $rvm_version $gemset}"
23
19
}
20
+
21
+ echo -n "${(j: :):-$GEOMETRY_RUBY $ruby_version $rvm_version $gemset}"
Original file line number Diff line number Diff line change 1
1
# geometry_rust_version - display the current version of rust (by @drager)
2
2
3
- geometry_rust_version() {
4
- { test -f Cargo.toml || ls -1 '*rs' 2>/dev/null; } || return 1
3
+ { test -f Cargo.toml || ls -1 '*rs' 2>/dev/null; } || return 1
5
4
6
- local rust_version="$(rustc --version | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')"
7
-
8
- ansi ${GEOMETRY_RUST_VERSION_COLOR:=red} v$rust_version
9
- }
5
+ local rust_version="$(rustc --version | \grep --color=never -oE '[0-9]+\.[0-9]+\.[0-9]')"
6
+
7
+ ansi ${GEOMETRY_RUST_VERSION_COLOR:=red} v$rust_version
Original file line number Diff line number Diff line change 1
1
# geometry_rustup - display a symbol colored with the currently selected rustup toolchain
2
2
3
- geometry_rustup() {
4
- (( $+commands[rustup] )) || return
3
+ (( $+commands[rustup] )) || return
5
4
6
- ( ${GEOMETRY_RUSTUP_PIN:=false} ) || { cargo locate-project 2>/dev/null || { echo -n '' && return; } }
5
+ ( ${GEOMETRY_RUSTUP_PIN:=false} ) || { cargo locate-project 2>/dev/null || { echo -n '' && return; } }
7
6
8
- : ${GEOMETRY_RUSTUP_STABLE_COLOR:=green}
9
- : ${GEOMETRY_RUSTUP_BETA_COLOR:=yellow}
10
- : ${GEOMETRY_RUSTUP_NIGHTLY_COLOR:=red}
7
+ : ${GEOMETRY_RUSTUP_STABLE_COLOR:=green}
8
+ : ${GEOMETRY_RUSTUP_BETA_COLOR:=yellow}
9
+ : ${GEOMETRY_RUSTUP_NIGHTLY_COLOR:=red}
11
10
12
- local toolchain="$(rustup show | grep 'stable|beta|nightly' | head -n 1 | cut -d '-' -f 1 | tr -d '\n' 2> /dev/null)"
13
- local rustup_color=${(e)toolchain:+\$GEOMETRY_RUSTUP_${toolchain:u}_COLOR}
11
+ local toolchain="$(rustup show | grep 'stable|beta|nightly' | head -n 1 | cut -d '-' -f 1 | tr -d '\n' 2> /dev/null)"
12
+ local rustup_color=${(e)toolchain:+\$GEOMETRY_RUSTUP_${toolchain:u}_COLOR}
14
13
15
- ansi $rustup_color ${GEOMETRY_RUSTUP_SYMBOL:=⚙}
16
- }
14
+ ansi $rustup_color ${GEOMETRY_RUSTUP_SYMBOL:=⚙}
Original file line number Diff line number Diff line change 1
1
# geometry_status - show a symbol with error/success and root/non-root information
2
2
3
- geometry_status() {
4
- local root; [[ $UID = 0 || $EUID = 0 ]] && root=true || root=false
5
- local error; (( $GEOMETRY[LAST_STATUS] )) && error=true || error=false
3
+ local root; [[ $UID = 0 || $EUID = 0 ]] && root=true || root=false
4
+ local error; (( $GEOMETRY[LAST_STATUS] )) && error=true || error=false
6
5
7
- local color=${GEOMETRY_STATUS_COLOR:-default}
6
+ local color=${GEOMETRY_STATUS_COLOR:-default}
8
7
9
- if ( $error );
10
- then
11
- color=${GEOMETRY_STATUS_COLOR_ERROR:-red};
12
- fi
8
+ if ( $error );
9
+ then
10
+ color=${GEOMETRY_STATUS_COLOR_ERROR:-red};
11
+ fi
13
12
14
- ( $root && $error ) && ansi $color ${GEOMETRY_STATUS_SYMBOL_ROOT_ERROR:=▽} && return
15
- ( $root ) && ansi $color ${GEOMETRY_STATUS_SYMBOL_ROOT:-▼} && return
16
- ( $error ) && ansi $color ${GEOMETRY_STATUS_SYMBOL_ERROR:-△} && return
17
- ansi $color ${GEOMETRY_STATUS_SYMBOL:-▲}
18
- }
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:-▲}
You can’t perform that action at this time.
0 commit comments