show_iso_url test_iso_url open_distro_homepage

This commit is contained in:
zenobit 2023-10-24 21:56:34 +02:00 committed by Martin Wimpress
parent 58e69834cb
commit 75b97b4294
1 changed files with 27 additions and 11 deletions

View File

@ -25,15 +25,27 @@ function cleanup() {
fi
}
if [ "${1}" == '-t' ]; then
testmode="on"
if [ -n "$4" ]; then
set -- "$2" "$3" "$4"
elif [ -n "$3" ]; then
set -- "$2" "$3"
else
if [ "${1}" == '--test-iso-url' ]; then
test_iso_url="on"
if [ -n "$4" ]; then
set -- "$2" "$3" "$4"
elif [ -n "$3" ]; then
set -- "$2" "$3"
else
set -- "$2"
fi
elif [ "${1}" == '--show-iso-url' ]; then
show_iso_url="on"
if [ -n "$4" ]; then
set -- "$2" "$3" "$4"
elif [ -n "$3" ]; then
set -- "$2" "$3"
else
set -- "$2"
fi
elif [ "${1}" == '--open-distro-homepage' ]; then
open_distro_homepage="on"
set -- "$2"
fi
fi
function pretty_name() {
@ -861,10 +873,14 @@ function web_get() {
fi
echo #Necessary as aria2c in suppressed mode does not have new lines
# Test mode for ISO (yet wget only)
elif [ "${testmode}" == 'on' ]; then
elif [ "${show_iso_url}" == 'on' ]; then
echo "${URL}"
#wget --spider "${URL}"
exit 1
exit 0
elif [ "${test_iso_url}" == 'on' ]; then
wget --spider "${URL}"
exit 0
elif [ "${open_distro_homepage}" == 'on' ]; then
xdgopen "${distro_homepage}" && exit 0
else
if ! wget --quiet --continue --tries=3 --read-timeout=10 --show-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}"; then
echo "ERROR! Failed to download ${URL} with wget. Try running 'quickget' again."