some more commands for flip

This commit is contained in:
2018-08-24 16:11:33 +03:00
parent a8c1cdc4b1
commit 0fbb8d0780

View File

@@ -9,13 +9,15 @@ _help() {
Commands: Commands:
(l)ist [default] List names of clipboards (l)ist [default] List names of clipboards
(r)ead Display on screen / copies to file (r)ead Read from clipboard, write to stdout or file
(w)rite Save from stdin / from file / folder (w)rite Save to clipboard, read from stdin/file/folder
(d)elete Delete an entry (d)elete Delete an entry
url Get the direct share url url Get the direct share url
upload Get URL for uploads
update Update flip client update Update flip client
Name: Any string for the clipboard name. default: 0 Name: Any string for the clipboard name. default: 0
Filename: Filename:
When reading from clipboard: When reading from clipboard:
File or folder to write the clipboard contents. If omitted: stdout File or folder to write the clipboard contents. If omitted: stdout
@@ -74,6 +76,7 @@ _write() {
_write_file "$NAME" "$FILE" _write_file "$NAME" "$FILE"
} }
} }
_url "$NAME"
} }
_write_folder() { # name, file _write_folder() { # name, file
@@ -113,6 +116,11 @@ _url() { # name
curl -s "$FLEES_ROOTURL/file/direct/$FLEES_SHARE/$FLEES_TOKEN/$1" curl -s "$FLEES_ROOTURL/file/direct/$FLEES_SHARE/$FLEES_TOKEN/$1"
echo '' echo ''
} }
_upload_url() {
echo "This information is a security risk, watch where it's shared"
echo "curl -s $FLEES_ROOTURL/script/upload/$FLEES_SHARE/$FLEES_TOKEN | bash /dev/stdin file_to_upload.ext"
exit
}
_msg() { _msg() {
echo "$@" >&2 echo "$@" >&2
} }
@@ -158,6 +166,7 @@ CMD=list
[[ "$1" = "l" || "$1" = "list" ]] && { CMD=list; ARG1=$CMD; } [[ "$1" = "l" || "$1" = "list" ]] && { CMD=list; ARG1=$CMD; }
[[ "$1" = "url" ]] && { CMD=url; ARG1=$CMD; } [[ "$1" = "url" ]] && { CMD=url; ARG1=$CMD; }
[[ "$1" = "update" ]] && { _update_client; } [[ "$1" = "update" ]] && { _update_client; }
[[ "$1" = "upload" ]] && { _upload_url; }
[[ "$1" = "h" || "$1" = "help" ]] && _help [[ "$1" = "h" || "$1" = "help" ]] && _help
[[ "$CMD" = list ]] && { [[ "$CMD" = list ]] && {