spaceship-prompt 4.15.2 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spaceship-prompt",
3
- "version": "4.15.2",
3
+ "version": "4.16.0",
4
4
  "description": "A Zsh prompt for Astronauts.",
5
5
  "files": [
6
6
  "lib",
package/scripts/tests CHANGED
@@ -52,6 +52,11 @@ header() {
52
52
  main() {
53
53
  for test in $TESTS; do
54
54
  header "Run $test..."
55
+ if [[ ! -x "$test" ]]; then
56
+ header $red "Test $test is not executable!"
57
+ EXIT_CODE=1
58
+ continue
59
+ fi
55
60
  ( eval zsh $test 2>&1 )
56
61
  local exitcode="$?"
57
62
  [ "$exitcode" != "0" ] && EXIT_CODE=$exitcode
package/sections/git.zsh CHANGED
@@ -13,7 +13,7 @@ SPACESHIP_GIT_SUFFIX="${SPACESHIP_GIT_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}
13
13
  SPACESHIP_GIT_SYMBOL="${SPACESHIP_GIT_SYMBOL=" "}"
14
14
 
15
15
  if [ -z "$SPACESHIP_GIT_ORDER" ]; then
16
- SPACESHIP_GIT_ORDER=(git_branch git_status)
16
+ SPACESHIP_GIT_ORDER=(git_branch git_status git_commit)
17
17
  fi
18
18
 
19
19
  # ------------------------------------------------------------------------------
@@ -22,9 +22,11 @@ fi
22
22
 
23
23
  source "$SPACESHIP_ROOT/sections/git_branch.zsh"
24
24
  source "$SPACESHIP_ROOT/sections/git_status.zsh"
25
+ source "$SPACESHIP_ROOT/sections/git_commit.zsh"
25
26
 
26
27
  spaceship::precompile "$SPACESHIP_ROOT/sections/git_branch.zsh"
27
28
  spaceship::precompile "$SPACESHIP_ROOT/sections/git_status.zsh"
29
+ spaceship::precompile "$SPACESHIP_ROOT/sections/git_commit.zsh"
28
30
 
29
31
  # ------------------------------------------------------------------------------
30
32
  # Section
@@ -0,0 +1,36 @@
1
+ #
2
+ # Git commit
3
+ #
4
+
5
+ # ------------------------------------------------------------------------------
6
+ # Configuration
7
+ # ------------------------------------------------------------------------------
8
+
9
+ SPACESHIP_GIT_COMMIT_SHOW="${SPACESHIP_GIT_COMMIT_SHOW=false}"
10
+ SPACESHIP_GIT_COMMIT_ASYNC="${SPACESHIP_GIT_COMMIT_ASYNC=true}"
11
+ SPACESHIP_GIT_COMMIT_PREFIX="${SPACESHIP_GIT_COMMIT_PREFIX=" "}"
12
+ SPACESHIP_GIT_COMMIT_SYMBOL="${SPACESHIP_GIT_COMMIT_SYMBOL="#"}"
13
+ SPACESHIP_GIT_COMMIT_SUFFIX="${SPACESHIP_GIT_COMMIT_SUFFIX=""}"
14
+ SPACESHIP_GIT_COMMIT_COLOR="${SPACESHIP_GIT_COMMIT_COLOR="yellow"}"
15
+
16
+ # ------------------------------------------------------------------------------
17
+ # Section
18
+ # ------------------------------------------------------------------------------
19
+
20
+ spaceship_git_commit() {
21
+ [[ $SPACESHIP_GIT_COMMIT_SHOW == false ]] && return
22
+
23
+ spaceship::is_git || return
24
+
25
+ # Get commit short commit hash
26
+ commit_hash=$(command git rev-parse --short HEAD 2>/dev/null)
27
+
28
+ if [[ -n $commit_hash ]]; then
29
+ spaceship::section \
30
+ --color "$SPACESHIP_GIT_COMMIT_COLOR" \
31
+ --prefix "$SPACESHIP_GIT_COMMIT_PREFIX" \
32
+ --suffix "$SPACESHIP_GIT_COMMIT_SUFFIX" \
33
+ --symbol "$SPACESHIP_GIT_COMMIT_SYMBOL" \
34
+ "$commit_hash"
35
+ fi
36
+ }
@@ -31,7 +31,7 @@ spaceship_kubectl_version() {
31
31
  [[ -z $kube_context ]] && return
32
32
 
33
33
  # if kubectl can't connect kubernetes cluster, kubernetes version section will be not shown
34
- local kubectl_version=$(kubectl version --short 2>/dev/null | grep "Server Version" | sed 's/Server Version: \(.*\)/\1/')
34
+ local kubectl_version=$(kubectl version 2>/dev/null | grep "Server Version" | sed 's/Server Version: \(.*\)/\1/')
35
35
  [[ -z $kubectl_version ]] && return
36
36
 
37
37
  spaceship::section \
@@ -0,0 +1,44 @@
1
+ #
2
+ # Red
3
+ #
4
+ # Red is a next-gen programming language, strongly inspired by REBOL
5
+ # Link: https://www.red-lang.org/
6
+
7
+ # ------------------------------------------------------------------------------
8
+ # Configuration
9
+ # ------------------------------------------------------------------------------
10
+
11
+ SPACESHIP_RED_SHOW="${SPACESHIP_RED_SHOW=true}"
12
+ SPACESHIP_RED_ASYNC="${SPACESHIP_RED_ASYNC=true}"
13
+ SPACESHIP_RED_PREFIX="${SPACESHIP_RED_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
14
+ SPACESHIP_RED_SUFFIX="${SPACESHIP_RED_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
15
+ SPACESHIP_RED_SYMBOL="${SPACESHIP_RED_SYMBOL="🔺 "}"
16
+ SPACESHIP_RED_COLOR="${SPACESHIP_RED_COLOR="red"}"
17
+
18
+ # ------------------------------------------------------------------------------
19
+ # Section
20
+ # ------------------------------------------------------------------------------
21
+
22
+ # Show current version of Python
23
+ spaceship_red() {
24
+ [[ $SPACESHIP_RED_SHOW == false ]] && return
25
+
26
+ # Show red version only in directories with relevant files
27
+ local is_red_project="$(spaceship::upsearch red.rc redbol)"
28
+ [[ -n "$is_red_project" || -n *.red(#qN^/) || -n *.reds(#qN^/) ]] || return
29
+
30
+ local red_version
31
+
32
+ if [[ -n "$VIRTUAL_ENV" ]] || [[ $SPACESHIP_RED_SHOW == always ]]; then
33
+ red_version=${(@)$(red --version 2>&1)[2]}
34
+ fi
35
+
36
+ [[ -z $red_version ]] && return
37
+
38
+ spaceship::section \
39
+ --color "$SPACESHIP_RED_COLOR" \
40
+ --prefix "$SPACESHIP_RED_PREFIX" \
41
+ --suffix "$SPACESHIP_RED_SUFFIX" \
42
+ --symbol "$SPACESHIP_RED_SYMBOL" \
43
+ "$red_version"
44
+ }
package/spaceship.zsh CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  # Current version of Spaceship
10
10
  # Useful for issue reporting
11
- export SPACESHIP_VERSION='4.15.2'
11
+ export SPACESHIP_VERSION='4.16.0'
12
12
 
13
13
  # Set SPACESHIP_ROOT if it isn't defined yet or if the directory does
14
14
  # not exist anymore (e.g. after an update to a newer version)
@@ -44,7 +44,7 @@ if [ -z "$SPACESHIP_PROMPT_ORDER" ]; then
44
44
  user # Username section
45
45
  dir # Current directory section
46
46
  host # Hostname section
47
- git # Git section (git_branch + git_status)
47
+ git # Git section (git_branch + git_status + [git_commit](default off))
48
48
  hg # Mercurial section (hg_branch + hg_status)
49
49
  package # Package version
50
50
  node # Node.js section
@@ -52,6 +52,7 @@ if [ -z "$SPACESHIP_PROMPT_ORDER" ]; then
52
52
  deno # Deno section
53
53
  ruby # Ruby section
54
54
  python # Python section
55
+ red # Red section
55
56
  elm # Elm section
56
57
  elixir # Elixir section
57
58
  xcode # Xcode section