Skip to content

Commit f5c7633

Browse files
AbdullahM0hamedxalexalex
authored andcommitted
termux-download: add ability to set download path
1 parent b34d4c8 commit f5c7633

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/termux-download

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ show_usage () {
77
echo "Download a resource using the system download manager."
88
echo " -d description description for the download request notification"
99
echo " -t title title for the download request notification"
10+
echo " -p path full path to which the file should be downloaded"
1011
exit 0
1112
}
1213

1314
ARG_D=""
1415
OPT_D=""
1516
ARG_T=""
1617
OPT_T=""
18+
ARG_P=""
19+
OPT_P=""
1720

18-
while getopts :hd:t: option
21+
while getopts :hd:t:p: option
1922
do
2023
case "$option" in
2124
h) show_usage;;
2225
d) ARG_D="--es description"; OPT_D="$OPTARG";;
2326
t) ARG_T="--es title"; OPT_T="$OPTARG";;
27+
p) ARG_P="--es path"; OPT_P="$OPTARG";;
2428
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
2529
esac
2630
done
@@ -34,6 +38,7 @@ URL_TO_DOWNLOAD="$1"
3438
set --
3539
if [ -n "$ARG_D" ]; then set -- "$@" $ARG_D "$OPT_D"; fi
3640
if [ -n "$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi
41+
if [ -n "$ARG_P" ]; then set -- "$@" $ARG_P "$OPT_P"; fi
3742
set -- "$@" "$URL_TO_DOWNLOAD"
3843

3944
/data/data/com.termux/files/usr/libexec/termux-api Download "$@"

0 commit comments

Comments
 (0)