spaceship-prompt 4.13.0 → 4.13.2

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/async.zsh CHANGED
@@ -3,12 +3,12 @@
3
3
  #
4
4
  # zsh-async
5
5
  #
6
- # version: v1.8.5
6
+ # version: v1.8.6
7
7
  # author: Mathias Fredriksson
8
8
  # url: https://github.com/mafredri/zsh-async
9
9
  #
10
10
 
11
- typeset -g ASYNC_VERSION=1.8.5
11
+ typeset -g ASYNC_VERSION=1.8.6
12
12
  # Produce debug output from zsh-async when set to 1.
13
13
  typeset -g ASYNC_DEBUG=${ASYNC_DEBUG:-0}
14
14
 
@@ -20,7 +20,7 @@ _async_eval() {
20
20
  # simplicity, this could be improved in the future.
21
21
  {
22
22
  eval "$@"
23
- } &> >(ASYNC_JOB_NAME=[async/eval] _async_job 'cat')
23
+ } &> >(ASYNC_JOB_NAME=[async/eval] _async_job 'command -p cat')
24
24
  }
25
25
 
26
26
  # Wrapper for jobs executed by the async worker, gives output in parseable format with execution time
@@ -46,7 +46,7 @@ _async_job() {
46
46
  duration=$(( EPOCHREALTIME - duration )) # Calculate duration.
47
47
 
48
48
  print -r -n - $'\0'${(q)jobname} $ret ${(q)stdout} $duration
49
- } 2> >(stderr=$(cat) && print -r -n - " "${(q)stderr}$'\0')
49
+ } 2> >(stderr=$(command -p cat) && print -r -n - " "${(q)stderr}$'\0')
50
50
  )"
51
51
  if [[ $out != $'\0'*$'\0' ]]; then
52
52
  # Corrupted output (aborted job?), skipping.
@@ -232,7 +232,7 @@ _async_worker() {
232
232
  # recreate it when there are no other jobs running.
233
233
  if (( ! coproc_pid )); then
234
234
  # Use coproc as a mutex for synchronized output between children.
235
- coproc cat
235
+ coproc command -p cat
236
236
  coproc_pid="$!"
237
237
  # Insert token into coproc
238
238
  print -n -p "t"
@@ -325,7 +325,7 @@ async_process_results() {
325
325
  else
326
326
  # In case of corrupt data, invoke callback with *async* as job
327
327
  # name, non-zero exit status and an error message on stderr.
328
- $callback "[async]" 1 "" 0 "$0:$LINENO: error: bad format, got ${#items} items (${(q)items})" $has_next
328
+ $callback "[async]" 1 "" 0 "$0:$LINENO: error: bad format, got ${#items} items (${(q)items})" $has_next
329
329
  fi
330
330
  done
331
331
  done
@@ -392,6 +392,9 @@ _async_send_job() {
392
392
  #
393
393
  # Start a new asynchronous job on specified worker, assumes the worker is running.
394
394
  #
395
+ # Note if you are using a function for the job, it must have been defined before the worker was
396
+ # started or you will get a `command not found` error.
397
+ #
395
398
  # usage:
396
399
  # async_job <worker_name> <my_function> [<function_params>]
397
400
  #
package/lib/utils.zsh CHANGED
@@ -161,9 +161,13 @@ spaceship::upsearch() {
161
161
  while [ "$root" ]; do
162
162
  # For every file as an argument
163
163
  for file in "${files[@]}"; do
164
- local filepath="$(find $root -maxdepth 1 -name $file -print -quit 2>/dev/null)"
165
- if [[ -n "$filepath" ]]; then
166
- [[ -z "$silent" ]] && echo "$filepath"
164
+ local find_match="$(find $root -maxdepth 1 -name $file -print -quit 2>/dev/null)"
165
+ local filename="$root/$file"
166
+ if [[ -n "$find_match" ]]; then
167
+ [[ -z "$silent" ]] && echo "$find_match"
168
+ return 0
169
+ elif [[ -e "$filename" ]]; then
170
+ [[ -z "$silent" ]] && echo "$filename"
167
171
  return 0
168
172
  fi
169
173
  done
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spaceship-prompt",
3
- "version": "4.13.0",
3
+ "version": "4.13.2",
4
4
  "description": "A Zsh prompt for Astronauts.",
5
5
  "files": [
6
6
  "lib",
@@ -31,7 +31,7 @@ spaceship_pulumi() {
31
31
  local pulumi_project=$(spaceship::upsearch Pulumi.y*ml)
32
32
  [[ -n "$pulumi_project" || -d .pulumi/stacks ]] || return
33
33
 
34
- local pulumi_stack=$(pulumi stack ls 2>/dev/null | sed -n -e '2p' | cut -f1 -d" " | sed s/\*//)
34
+ local pulumi_stack=$(pulumi stack ls 2>/dev/null | sed -n -e '/\x2A/p' | cut -f1 -d" " | sed s/\*//)
35
35
  [[ -z $pulumi_stack ]] && return
36
36
 
37
37
  spaceship::section \
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.13.0'
11
+ export SPACESHIP_VERSION='4.13.2'
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)