# shellcheck shell=dash

xrc:mod:lib os              \
    osarch release   \
    loadavg uptime          \
    __app

___x_cmd_os___main(){
    [ "$#" -gt 0 ] ||           set -- --app

    local subcmd="${1}";        shift
    case "$subcmd" in
        -h|--help)              ___x_cmd help -m os "$@" ; return 0 ;;

        is)                     ___x_cmd_os_is              "$@"    ;;
        uname_)                 ___x_cmd_os_uname_          "$@"    ;;

        name_)                  ___x_cmd_os_name_           "$@"    ;;
        getname_)               ___x_cmd_os_getname_        "$@"    ;;

        arch_)                  ___x_cmd_os_arch_           "$@"    ;;
        getarch_)               ___x_cmd_os_getarch_        "$@"    ;;

        uname)                  ___x_cmd_os_uname           "$@"    ;;
        name)                   ___x_cmd_os_name            "$@"    ;;
        arch)                   ___x_cmd_os_arch            "$@"    ;;


        release)                ___x_cmd_os_release         "$@"    ;;
        rname)                  ___x_cmd_os_release_name    "$@"    ;;

        lsuname)                ___x_cmd_os_lsuname         "$@"    ;;
        lsname)                 ___x_cmd_os_lsname          "$@"    ;;
        lsarch)                 ___x_cmd_os_lsarch          "$@"    ;;
        # ls)                     "___x_cmd_os_ls_$1"                 ;;

        loadavg)                ___x_cmd_os_loadavg         "$@"    ;;

        --app)                  ___x_cmd_os___app           "$@"    ;;

        cpu)                    ___x_cmd cpu info           "$@"    ;;

        hostname)               ___x_cmd hostname get       "$@"    ;;
        hostname_)              ___x_cmd hostname get_      "$@"    ;;

        endi|endianness|endian)  ___x_cmd cpu endianness    "$@"    ;;

        uptime_)                ___x_cmd_os_uptime_         "$@"    ;;
        uptime)                 ___x_cmd_os_uptime          "$@"    ;;
        path)                   ___x_cmd path               "$@"    ;;

        *)                      N=os M="Unsupported subcmd -> $subcmd" log:ret:64 ;;
    esac
}


