Konstantin Demin
8834da817c
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
25 lines
485 B
Bash
25 lines
485 B
Bash
#!/bin/zsh
|
|
|
|
z-orig-term() {
|
|
local -a a
|
|
local i x
|
|
|
|
for i ( ${ZSHU_PARENTS_PID} ) ; do
|
|
i="${ZSHU[procfs]}/$i/environ"
|
|
[ -r "$i" ] || continue
|
|
x=$(sed -zEn '/^TERM=(.+)$/{s//\1/;p;}' "$i" 2>/dev/null | tr -d '\0')
|
|
[ -n "$x" ] || continue
|
|
a+=( "$x" )
|
|
done
|
|
case "$1" in
|
|
\* | @ )
|
|
local ORIG_TERM=( $a )
|
|
declare -p ORIG_TERM
|
|
;;
|
|
* )
|
|
i='-1' ; x="${1:-$i}"
|
|
echo "${a[$x]}"
|
|
;;
|
|
esac
|
|
}
|