Commit facfa054 authored by Vitaly Lipatov's avatar Vitaly Lipatov

tools_eget: improve error handling

parent 7a2738c7
......@@ -69,6 +69,7 @@ scat()
{
$CURL -L $CURLQ "$1"
}
# download to default name of to $2
sget()
{
......@@ -163,14 +164,21 @@ if echo "$1" | grep -q "^https://github.com/" && ! echo "$1" | grep -q "/release
MASK="$2"
if [ -n "$LISTONLY" ] ; then
get_github_urls "$1" | filter_glob "$MASK" | filter_order
fn=''
for fn in $(get_github_urls "$1" | filter_glob "$MASK" | filter_order) ; do
echo "$fn"
done
test -n "$fn"
exit
fi
ERROR=0
fn=''
for fn in $(get_github_urls "$1" | filter_glob "$MASK" | filter_order) ; do
sget "$fn" || ERROR=1
done
exit
test -n "$fn" || ERROR=1
exit $ERROR
fi
......@@ -206,16 +214,20 @@ get_urls()
}
if [ -n "$LISTONLY" ] ; then
fn=''
for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do
# TODO: return full url? someone use old behaviour?
echo "$(basename "$fn")"
done
test -n "$fn"
exit
fi
ERROR=0
fn=''
for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do
sget "$URL/$(basename "$fn")" || ERROR=1
done
test -n "$fn" || ERROR=1
exit $ERROR
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment