31 lines
		
	
	
	
		
			620 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			620 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/usr/bin/env zsh
 | 
						|
# Eryn Wells <eryn@erynwells.me>
 | 
						|
 | 
						|
function nethack
 | 
						|
{
 | 
						|
    local remote
 | 
						|
    while getopts 'lr' opt; do
 | 
						|
        case $opt in
 | 
						|
            h) echo "Usage: $0 [-l][-r]";;
 | 
						|
            l) remote=0;;
 | 
						|
            r) remote=1;;
 | 
						|
            *)
 | 
						|
                echo "Invalid argument: $OPTARG" 1>&2
 | 
						|
                return -1
 | 
						|
                ;;
 | 
						|
        esac
 | 
						|
    done
 | 
						|
 | 
						|
    if (( $remote )); then
 | 
						|
        ssh nethack@alt.org
 | 
						|
        return $?
 | 
						|
    elif binary_exists nethack; then
 | 
						|
        command nethack "$@[$OPTIND,-1]"
 | 
						|
        return $?
 | 
						|
    else
 | 
						|
        ssh nethack@alt.org
 | 
						|
        return $?
 | 
						|
    fi
 | 
						|
}
 | 
						|
 | 
						|
nethack "$@"
 |