direct url extract for flip

This commit is contained in:
2018-08-21 14:56:56 +03:00
parent 2c67bc2ca6
commit 020bb20327
2 changed files with 26 additions and 19 deletions

View File

@@ -8,10 +8,11 @@ _help() {
Usage: $SELF [command] [name] [filename]
Commands:
(l)ist [default] List names of clipboards
(r)ead Display on screen / copies to file
(w)rite Save from stdin / from file / folder
(d)elete Delete an entry
(l)ist [default] List names of clipboards
url Get the direct share url
Name: Any string for the clipboard name. default: 0
Filename:
@@ -107,6 +108,10 @@ _delete() { # name
curl -s "$FLEES_ROOTURL/file/delete/$FLEES_SHARE/$FLEES_TOKEN/$1"
}
_url() { # name
curl -s "$FLEES_ROOTURL/file/direct/$FLEES_SHARE/$FLEES_TOKEN/$1"
echo ''
}
_msg() {
echo "$@" >&2
}
@@ -145,6 +150,7 @@ CMD=list
[[ "$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" = "url" ]] && { CMD=url; ARG1=$CMD; }
[[ "$1" = "update" ]] && { _update_client; }
[[ "$1" = "h" || "$1" = "help" ]] && _help
# if stdout redirected, default to read
@@ -171,8 +177,8 @@ _get_file
_write
exit $?
}
[[ "$CMD" = edit ]] && {
_edit
[[ "$CMD" = url ]] && {
_url "$NAME"
exit $?
}