This commit is contained in:
Q
2023-08-19 22:02:13 +03:00
parent 7b0c9d0ad2
commit 24172b6bb6

View File

@@ -9,6 +9,7 @@ _help() {
(l)ist [default] List names of files (l)ist [default] List names of files
(w)rite Save to share, read from stdin/file/folder (w)rite Save to share, read from stdin/file/folder
(d)elete Delete an entry (d)elete Delete an entry
show Show details on file
upload Get URL for uploads [no arguments] upload Get URL for uploads [no arguments]
autocomplete Get Bash autocompletion script autocomplete Get Bash autocompletion script
update Update self update Update self
@@ -127,9 +128,6 @@ _write_stdin() { # name
-H "Secret: $MFL_TOKEN" \ -H "Secret: $MFL_TOKEN" \
"$MFL_ROOTURL"/upload "$MFL_ROOTURL"/upload
} }
#~ _link_format() {
#~ sed -e 's/^http:/https:/' -e 'p;' | sed -e "2s|$MFL_ROOTURL|&/dl|"
#~ }
_delete() { # name _delete() { # name
read -p "Sure to delete: $1 ? Break to exit " foo read -p "Sure to delete: $1 ? Break to exit " foo
@@ -137,18 +135,12 @@ _delete() { # name
-H "Secret: $MFL_TOKEN" \ -H "Secret: $MFL_TOKEN" \
"$MFL_ROOTURL"/delete/"$1" "$MFL_ROOTURL"/delete/"$1"
} }
_details() { # name
curl -fL -w "\n" \
-H "Secret: $MFL_TOKEN" \
"$MFL_ROOTURL"/details/"$1"
}
#~ _upload_url() {
#~ echo "This information is a security risk, watch where it's shared"
#~ echo "curl -fL -w \"\\n\" -H \"Max-Days: $MAXDAYS\" -u \"${USER}:${PASSWORD}\" $MFL_ROOTURL/[FILENAME] --upload-file [FILENAME]"
#~ exit
#~ }
#~ _self_url() {
#~ echo "This information is a security risk, watch where it's shared"
#~ echo "curl -L -H \"Token: $PASSWORD\" \"${MFL_ROOTURL}/xfer.sh\""
#~ exit
#~ }
_msg() { _msg() {
echo "$@" >&2 echo "$@" >&2
@@ -216,6 +208,7 @@ fi
[[ "$1" = "w" || "$1" = "write" ]] && { CMD=write; ARG1=$CMD; } [[ "$1" = "w" || "$1" = "write" ]] && { CMD=write; ARG1=$CMD; }
[[ "$1" = "d" || "$1" = "delete" || "$1" = "del" ]] && { CMD=delete; ARG1=$CMD; } [[ "$1" = "d" || "$1" = "delete" || "$1" = "del" ]] && { CMD=delete; ARG1=$CMD; }
[[ "$1" = "l" || "$1" = "list" ]] && { CMD=list; ARG1=$CMD; } [[ "$1" = "l" || "$1" = "list" ]] && { CMD=list; ARG1=$CMD; }
[[ "$1" = "show" ]] && { CMD=details; ARG1=$CMD; }
[[ "$1" = "simplelist" ]] && { CMD=simple_list; ARG1=$CMD; } [[ "$1" = "simplelist" ]] && { CMD=simple_list; ARG1=$CMD; }
[[ "$1" = "autocomplete" ]] && { _get_completer; } [[ "$1" = "autocomplete" ]] && { _get_completer; }
[[ "$1" = "update" ]] && { _update_client; } [[ "$1" = "update" ]] && { _update_client; }
@@ -253,3 +246,8 @@ fi
_write _write
exit $? exit $?
} }
[[ "$CMD" = details ]] && {
_details "$NAME"
exit $?
}