download with menu

This commit is contained in:
Q
2024-09-28 20:38:09 +03:00
parent 8bf9b80dff
commit 3323c4b7b8
2 changed files with 15 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ _help() {
upload_token Get URL for uploads ( -d expiry )
autocomplete Get Bash autocompletion script
update Update self
download Download using smenu
-d max days to keep (default 30)
-m max downloads to keep (default 9999, -1 to disable)
@@ -140,6 +141,14 @@ _maintain() {
"$MFL_ROOTURL"/maintenance
}
_download() {
choice=$( _simple_list | sed "s|^|$MFL_ROOTURL/d/|" | tac | \
smenu -t 1 -a c:2,bu i:8,b -n 25 -m "Download url" -W $'\n' \
)
if [[ -n "$choice" ]]; then
wget "$choice"
fi
}
_upload_token() {
token=$( curl -fL -s \
-H "Expires-Days: $MAXDAYS" \
@@ -233,6 +242,7 @@ fi
[[ "$1" = "w" || "$1" = "write" ]] && { CMD=write; ARG1=$CMD; }
[[ "$1" = "d" || "$1" = "delete" || "$1" = "del" ]] && { CMD=delete; ARG1=$CMD; }
[[ "$1" = "l" || "$1" = "list" ]] && { CMD=list; ARG1=$CMD; }
[[ "$1" = "download" ]] && { CMD=download; ARG1=$CMD; }
[[ "$1" = "show" ]] && { CMD=details; ARG1=$CMD; }
[[ "$1" = "maintain" ]] && { CMD=maintain; }
[[ "$1" = "simplelist" ]] && { CMD=simple_list; ARG1=$CMD; }
@@ -279,4 +289,8 @@ fi
_maintain
exit $?
}
[[ "$CMD" = download ]] && {
_download
exit $?
}