Files
RedBear-OS/recipes/shells/zsh/source/Functions/TCP/tcp_rename
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

44 lines
850 B
Plaintext

# Rename session OLD (defaults to current session) to session NEW.
# Does not handle aliases; use tcp_alias for all alias redefinitions.
local old new
if (( $# == 1 )); then
old=$TCP_SESS
new=$1
elif (( $# == 2 )); then
old=$1
new=$2
else
print "Usage: $0 OLD NEW" >&2
return 1
fi
local fd=$tcp_by_name[$old]
if [[ -z $fd ]]; then
print "No such session: $old" >&2
return 1
fi
if [[ -n $tcp_by_name[$new] ]]; then
print "Session $new already exists." >&2
return 1
fi
# Can't rename an alias
if [[ $tcp_by_fd[$fd] != $old ]]; then
print "Use tcp_alias to redefine an alias." >&2
return 1
fi
tcp_by_name[$new]=$fd
unset "tcp_by_name[$old]"
tcp_by_fd[$fd]=$new
[[ $TCP_SESS = $old ]] && TCP_SESS=$new
if zmodload -i zsh/parameter; then
if (( ${+functions[tcp_on_rename]} )); then
tcp_on_rename $new $fd $old
fi
fi