# shellcheck    shell=dash

___x_cmd_hi(){
    [ $# -gt 0 ]    ||  set -- --main
    local op="$1";      shift
    case "$op" in
        -h|--help)      ___x_cmd help -m   x-cmd  hi  ; return ;;
        *)              ___x_cmd_hi___main "$op" "$@" ;;
    esac
}

___x_cmd_hi___main(){
    if ___x_cmd_is_stdout2tty; then
        ___x_cmd_hi___raw | ___x_cmd j2y
    else
        ___x_cmd_hi___raw
    fi
}

___x_cmd_hi___raw(){
    ___x_cmd ccmd 1m -- ___x_cmd curl --max-time 2 -s --fail https://ipmac.hub.x-cmd.com/api/v0/httpinfo
}
