# shellcheck shell=dash
xrc:mod:lib     mac    _network/net/location

# Using networksetup

___x_cmd_mac_net(){
    [ "$#" -gt 0 ] || set -- -h

    local op="$1";  shift
    case "$op" in
        test|port|ip|location)
            ___x_cmd_mac_net_"$op"                       "$@" ;;
        -h|--help)
            N=mac M="mac net"               help:ret:0        ;;
        *)  N=mac M="Unknown subcmd -> $op" log:ret:64        ;;
    esac
}

___x_cmd_mac_net_test(){
    ___x_cmd_mac___cmd networkQuality -v
}

___x_cmd_mac_net_port(){
    ___x_cmd_mac___cmd lsof -iTCP -sTCP:LISTEN -P
    # lsof -i -P | grep LISTEN
    # netstat -an | grep LISTEN
}

___x_cmd_mac_net_ip(){
    ___x_cmd ip
    # ipconfig getifaddr en0
    # ipconfig getifaddr en1
}
