Name the set -u empty-array idiom and the @sh eval in statusline.sh

This commit was merged in pull request #29.
This commit is contained in:
2026-09-25 07:49:24 +02:00
parent dfab5b7e83
commit ded679119c
2 changed files with 2 additions and 1 deletions
+2
View File
@@ -4,6 +4,7 @@ set -uo pipefail
input=$(cat)
# @sh quotes every value, so the JSON reaches eval as data.
eval "$(printf '%s' "$input" | jq -r '
@sh "dir=\(.workspace.current_dir // .cwd // "")",
@sh "model=\(.model.display_name // "")",
@@ -108,6 +109,7 @@ join_parts() {
}
out=""
# ${a[@]+"${a[@]}"}: before bash 4.4 an empty array is unset under set -u.
for line in "$(join_parts ${row1[@]+"${row1[@]}"})" "$(join_parts ${row2[@]+"${row2[@]}"})"; do
[ -z "$line" ] && continue
[ -n "$out" ] && out+=$'\n'