spaceship-prompt 4.7.0 → 4.8.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.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "A Zsh prompt for Astronauts.",
5
5
  "files": [
6
6
  "lib",
package/sections/char.zsh CHANGED
@@ -10,6 +10,8 @@ SPACESHIP_CHAR_PREFIX="${SPACESHIP_CHAR_PREFIX=""}"
10
10
  SPACESHIP_CHAR_SUFFIX="${SPACESHIP_CHAR_SUFFIX=""}"
11
11
  SPACESHIP_CHAR_SYMBOL="${SPACESHIP_CHAR_SYMBOL="➜ "}"
12
12
  SPACESHIP_CHAR_SYMBOL_ROOT="${SPACESHIP_CHAR_SYMBOL_ROOT="$SPACESHIP_CHAR_SYMBOL"}"
13
+ SPACESHIP_CHAR_SYMBOL_SUCCESS="${SPACESHIP_CHAR_SYMBOL_SUCCESS="$SPACESHIP_CHAR_SYMBOL"}"
14
+ SPACESHIP_CHAR_SYMBOL_FAILURE="${SPACESHIP_CHAR_SYMBOL_FAILURE="$SPACESHIP_CHAR_SYMBOL"}"
13
15
  SPACESHIP_CHAR_SYMBOL_SECONDARY="${SPACESHIP_CHAR_SYMBOL_SECONDARY="$SPACESHIP_CHAR_SYMBOL"}"
14
16
  SPACESHIP_CHAR_COLOR_SUCCESS="${SPACESHIP_CHAR_COLOR_SUCCESS="green"}"
15
17
  SPACESHIP_CHAR_COLOR_FAILURE="${SPACESHIP_CHAR_COLOR_FAILURE="red"}"
@@ -26,19 +28,19 @@ spaceship_char() {
26
28
 
27
29
  if [[ $RETVAL -eq 0 ]]; then
28
30
  color="$SPACESHIP_CHAR_COLOR_SUCCESS"
31
+ char="$SPACESHIP_CHAR_SYMBOL_SUCCESS"
29
32
  else
30
33
  color="$SPACESHIP_CHAR_COLOR_FAILURE"
34
+ char="$SPACESHIP_CHAR_SYMBOL_FAILURE"
31
35
  fi
32
36
 
33
37
  if [[ $UID -eq 0 ]]; then
34
- symbol="$SPACESHIP_CHAR_SYMBOL_ROOT"
35
- else
36
- symbol="$SPACESHIP_CHAR_SYMBOL"
38
+ char="$SPACESHIP_CHAR_SYMBOL_ROOT"
37
39
  fi
38
40
 
39
41
  spaceship::section \
40
42
  --color "$color" \
41
43
  --prefix "$SPACESHIP_CHAR_PREFIX" \
42
44
  --suffix "$SPACESHIP_CHAR_SUFFIX" \
43
- --symbol "$symbol"
45
+ --symbol "$char"
44
46
  }
package/spaceship.zsh CHANGED
@@ -8,16 +8,19 @@
8
8
 
9
9
  # Current version of Spaceship
10
10
  # Useful for issue reporting
11
- export SPACESHIP_VERSION='4.7.0'
12
-
13
- # Determination of Spaceship working directory
14
- # https://git.io/vdBH7
15
- if [[ -z "$SPACESHIP_ROOT" ]]; then
11
+ export SPACESHIP_VERSION='4.8.0'
12
+
13
+ # Set SPACESHIP_ROOT if it isn't defined yet or if the directory does
14
+ # not exist anymore (e.g. after an update to a newer version)
15
+ # See https://github.com/spaceship-prompt/spaceship-prompt/pull/1280
16
+ if [[ -z "$SPACESHIP_ROOT" || ! -d "$SPACESHIP_ROOT" ]]; then
17
+ # Determination of Spaceship working directory
18
+ # https://git.io/vdBH7
16
19
  if [[ "${(%):-%N}" == '(eval)' ]]; then
17
20
  if [[ "$0" == '-antigen-load' ]] && [[ -r "${PWD}/spaceship.zsh" ]]; then
18
21
  # Antigen uses eval to load things so it can change the plugin (!!)
19
22
  # https://github.com/zsh-users/antigen/issues/581
20
- export -r SPACESHIP_ROOT=$PWD
23
+ export -r SPACESHIP_ROOT="$PWD"
21
24
  else
22
25
  print -P "%F{red}You must set SPACESHIP_ROOT to work from within an (eval).%f"
23
26
  return 1
@@ -26,7 +29,7 @@ if [[ -z "$SPACESHIP_ROOT" ]]; then
26
29
  # Get the path to file this code is executing in; then
27
30
  # get the absolute path and strip the filename.
28
31
  # See https://stackoverflow.com/a/28336473/108857
29
- export -r SPACESHIP_ROOT=${${(%):-%x}:A:h}
32
+ export -r SPACESHIP_ROOT="${${(%):-%x}:A:h}"
30
33
  fi
31
34
  fi
32
35