load-zellij works with noexec /tmp
This commit is contained in:
parent
c386ab3ef7
commit
b243ed34ff
37
load-zellij
37
load-zellij
|
@ -15,33 +15,32 @@ BASE_SHELL=$(basename "$SHELL")
|
||||||
|
|
||||||
if is_sourced; then
|
if is_sourced; then
|
||||||
zellij() {
|
zellij() {
|
||||||
if [[ -x /tmp/zellij/bootstrap/zellij ]]; then
|
if [[ ! -x ~/bin/zellij ]]; then
|
||||||
/tmp/zellij/bootstrap/zellij "${@}"
|
if [[ ! -x /tmp/zellij/bootstrap/zellij ]]; then
|
||||||
else
|
bash <(curl -sL zellij.dev/launch) "${@}" && return
|
||||||
bash <(curl -sL zellij.dev/launch) "${@}"
|
fi
|
||||||
|
fi
|
||||||
|
if [[ -e /tmp/zellij/bootstrap/zellij ]]; then
|
||||||
|
mv /tmp/zellij/bootstrap/zellij ~/bin/zellij
|
||||||
|
fi
|
||||||
|
if [[ -x ~/bin/zellij ]]; then
|
||||||
|
~/bin/zellij "${@}"
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
if [[ -z "$ZELLIJ_SESSION_NAME" ]]; then
|
|
||||||
# shellcheck disable=SC2210
|
|
||||||
#(zellij list-sessions 2&>1) > /dev/null || zellij attach -c "$USER@$(hostname)"
|
|
||||||
zellij attach -c "$USER@$(hostname)" || EXITCODE=$?
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086 # EXITCODE might be empty
|
}
|
||||||
return $EXITCODE
|
. <( zellij setup --generate-completion "$BASE_SHELL" )
|
||||||
fi
|
if [[ -z "$ZELLIJ_SESSION_NAME" ]]; then
|
||||||
if [[ -z "$ZSH_VERSION" ]] || (type compdef > /dev/null 2>&1); then
|
(zellij list-sessions 2&>1) > /dev/null || zellij attach -c $USER@$(hostname)
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. <( zellij setup --generate-completion "$BASE_SHELL" ) 2> /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [[ "$1" == '-' ]]; then
|
elif [[ "$1" == '-' ]]; then
|
||||||
echo "BASE_0=${BASE_0}"
|
cat "${BASH_SOURCE[0]}"
|
||||||
cat "${0}"
|
|
||||||
else
|
else
|
||||||
SCRIPT_NAME="$BASE_0"
|
SCRIPT_NAME="$BASE_0"
|
||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
"It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \
|
"It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \
|
||||||
'The easiest way is to call it like this:' \
|
'The easiest way is to call it like this:' \
|
||||||
" $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \
|
" $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \
|
||||||
''
|
''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue