
___x_cmd_ifconfig_show(){
    ___x_cmd_ifconfig___check

    local format=auto
    while [ $# -gt 0 ]; do
        case "$1" in
            --app)          format=app  ;;
            --tsv)          format=tsv  ;;
            --csv)          format=csv  ;;
            --raw)          format=raw  ;;
            -r|--colr)      format=colr ;;
            --auto)         format=auto ;;
            *)              break ;;
        esac
        shift
    done

    if ___x_cmd os is win; then
        # ___x_cmd pwsh ip --"$format" "$@"
        ___x_cmd pwsh ip
        return
    fi

    ___x_cmd_ifconfig_show___"$format" "$@"
}

___x_cmd_ifconfig_show___auto(){
    if ___x_cmd_is_stdout2tty; then     ___x_cmd_ifconfig_show___app    "$@"
    else                                ___x_cmd_ifconfig_show___tsv    "$@"
    fi
}

___x_cmd_ifconfig_show___csv(){
    ___x_cmd_ifconfig_show___tsv | ___x_cmd tsv tocsv
}

___x_cmd_ifconfig_show___tsv(){
    ___x_cmd_hascmd ifconfig || {
        ___x_cmd busybox ifconfig   | ___x_cmd_ifconfig_tsv busybox
        return
    }

    ! ___x_cmd os is darwin || {
        ___x_cmd_cmds ifconfig      | ___x_cmd_ifconfig_tsv darwin
        return
    }

    if ___x_cmd_cmds ifconfig --help 2>&1 | ___x_cmd_cmds grep -i busybox 2>/dev/null 1>/dev/null; then
        ___x_cmd_cmds ifconfig      | ___x_cmd_ifconfig_tsv busybox
    else
        ___x_cmd_cmds ifconfig      | ___x_cmd_ifconfig_tsv gnu
    fi
}

___x_cmd_ifconfig_show___colr(){
    ___x_cmd_ifconfig_show___raw "$@" | ___x_cmd_ifconfig_colr
}

___x_cmd_ifconfig_show___raw(){
    if ___x_cmd_hascmd ifconfig; then       ___x_cmd_cmds       ifconfig    "$@"
    else                                    ___x_cmd busybox    ifconfig    "$@"
    fi
}

___x_cmd_ifconfig_show___app(){
    ___x_cmd_ifconfig_show___csv "$@" | ___x_cmd csv app
}
