dotfiles/zsh/func/nethack

33 lines
652 B
Bash

#!/usr/bin/env zsh
# vim: set ft=zsh:
# Eryn Wells <eryn@erynwells.me>
function nethack
{
local remote
while getopts 'lr' opt; do
case $opt in
l) remote=0;;
r) remote=1;;
*)
echo "Invalid argument: $OPTARG" 1>&2
return -1
;;
esac
done
if (( $remote )) && binary_exists nethack; then
telnet nethack.alt.org
return $?
else
if binary_exists nethack; then
command nethack
return $?
else
telnet nethack.alt.org
return $?
fi
fi
}
nethack "$@"