32 lines
		
	
	
	
		
			627 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			627 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/usr/bin/env 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
 | 
						|
        ssh nethack@alt.org
 | 
						|
        return $?
 | 
						|
    else
 | 
						|
        if binary_exists nethack; then
 | 
						|
            command nethack
 | 
						|
            return $?
 | 
						|
        else
 | 
						|
            ssh nethack@alt.org
 | 
						|
            return $?
 | 
						|
        fi
 | 
						|
    fi
 | 
						|
}
 | 
						|
 | 
						|
nethack "$@"
 |