2015-08-14 21:27:47 +02:00
|
|
|
#!/bin/sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
SCRIPTNAME=$0
|
|
|
|
show_usage () {
|
|
|
|
echo "usage: termux-download <uri-to-download>"
|
|
|
|
echo " Download a resource using the system download manager."
|
|
|
|
echo " -d, --description Description for the download request notification"
|
|
|
|
echo " -t, --title Title for the download request notification"
|
|
|
|
}
|
|
|
|
|
|
|
|
PARAMS=""
|
|
|
|
O=`busybox getopt -q -l description: -l title: -l help -- d:t:h "$@"`
|
|
|
|
if [ $? != 0 ] ; then show_usage; exit 1 ; fi
|
|
|
|
eval set -- "$O"
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-h|--help) show_usage; exit 0;;
|
|
|
|
-d|--description) PARAMS="$PARAMS --es description '$2'"; shift 2;;
|
|
|
|
-t|--title) PARAMS="$PARAMS --es title '$2'"; shift 2;;
|
|
|
|
--) shift; break;;
|
|
|
|
*) echo Error; exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Too many arguments:
|
|
|
|
if [ $# != 1 ]; then show_usage; exit 1; fi
|
|
|
|
|
2015-08-14 21:27:47 +02:00
|
|
|
eval @TERMUX_API@ Download $PARAMS $1
|