
# reverse
# x ssh map server:8080 80

# direct
# x ssh map 80 server:1980

___x_cmd_ssh_map(){
    [ $# -gt 0 ] || {
        x help -m ssh map
        return 64
    }

    while [ $# -gt 0 ]; do
        case "$1" in
            *)          break ;;
        esac
    done

    if x is int "$1"; then
        ___x_cmd_ssh_map___direct "$@"
    else
        ___x_cmd_ssh_map___reverse "$@"
    fi
}

___x_cmd_ssh_map___direct(){
    command ssh -D "$1" "$2"
}

___x_cmd_ssh_map___reverse(){
    # add the argument to prevent ssh from exit
    command ssh -r "$1" "$2"
}
