[zsh] Fix the nethack function so it only triggers a remote session if you ask for it

This commit is contained in:
Eryn Wells 2023-03-25 08:08:41 -07:00
parent 79757c36a2
commit f392afe533

View file

@ -6,6 +6,7 @@ function nethack
local remote local remote
while getopts 'lr' opt; do while getopts 'lr' opt; do
case $opt in case $opt in
h) echo "Usage: $0 [-l][-r]";;
l) remote=0;; l) remote=0;;
r) remote=1;; r) remote=1;;
*) *)
@ -15,17 +16,15 @@ function nethack
esac esac
done done
if (( $remote )) && binary_exists nethack; then if (( $remote )); then
ssh nethack@alt.org ssh nethack@alt.org
return $? return $?
elif binary_exists nethack; then
command nethack "$@[$OPTIND,-1]"
return $?
else else
if binary_exists nethack; then ssh nethack@alt.org
command nethack return $?
return $?
else
ssh nethack@alt.org
return $?
fi
fi fi
} }