# shellcheck shell=dash
___x_cmd_apt___xproxy(){
    [ $# -gt 0 ]    ||  set - ls
    local op="$1";      shift

    local O=apt
    case "$op" in
        ls|use|unuse|try|untry)
            ___x_cmd proxy wrap "$op"  "$@" ;;
        -h|--help)
            ___x_cmd help -m apt proxy "$@" ;;
    esac
}

___x_cmd_apt___xproxy___inner_set(){
    local proxy="$2"

    case $proxy in
        https://*|http://*|socks*://*|ftp*://*)     ;;
        *)
            proxy="http://$proxy"
            apt:info "Considered as $proxy"
            ;;
    esac

    case "$1" in
        --http|http)
            http_proxy="$proxy"      ;;
        --https|https)
            https_proxy="$proxy"     ;;
        --all|all)
            all_proxy="$proxy"       ;;

        --adapt)
            http_proxy="$proxy"
            https_proxy="$proxy"
            all_proxy="$proxy"       ;;
    esac
    apt:info "use proxy  ==>  $proxy"
}
