pystardust / ani-cli

A cli tool to browse and play anime
GNU General Public License v3.0
7.89k stars 542 forks source link

is there a feature to use wget if curl is not installed by default in some linux distros #1415

Closed candrapersada closed 3 weeks ago

candrapersada commented 3 weeks ago
if which wget >/dev/null ; then
    echo "Downloading via wget."
    wget --option argument
elif which curl >/dev/null ; then
    echo "Downloading via curl."
    curl --option argument
else
    echo "Cannot download, neither wget nor curl is available."
fi

or

function download {
    url=$1
    filename=$2

    if [ -x "$(which wget)" ] ; then
        wget -q $url -O $2
    elif [ -x "$(which curl)" ]; then
        curl -o $2 -sfL $url
    else
        echo "Could not find curl or wget, please install one." >&2
    fi
}
# to use in the script:
download https://url /local/path/to/download
71zenith commented 3 weeks ago

Curl is available for all supported systems and most of the time preinstalled as well. We would rather always have less dependencies.