You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
835 B

#!/bin/sh
10 years ago
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
eval @TERMUX_API@ Download $PARAMS $1