flip writing made easier

This commit is contained in:
2018-09-19 10:06:41 +03:00
parent f8cb467dcb
commit 7834fb442d
2 changed files with 12 additions and 6 deletions

View File

@@ -13,8 +13,8 @@ _help() {
(w)rite Save to clipboard, read from stdin/file/folder
(d)elete Delete an entry
url Get the direct share url
upload Get URL for uploads
update Update flip client
upload Get URL for uploads [no arguments]
update Update flip client [no arguments]
Name: Any string for the clipboard name. default: 0
@@ -27,6 +27,7 @@ _help() {
Shorthand:
echo my data | $SELF 1 # writes data with name: 1
$SELF 1 | cat - # prints the contents of file: 1
$SELF w file.ext # sends file keeping its name
Config:
set: FLEES_ROOTURL, FLEES_SHARE, FLEES_TOKEN
@@ -57,8 +58,14 @@ _list() {
}
_write() {
# no file mentioned, use stdin
[[ -z "$FILE" ]] && stream_in=1
# no file mentioned, use the name as file
[[ -z "$FILE" ]] && {
[[ -e "$NAME" ]] && {
# NAME is actually the file, reverse roles
FILE="$NAME"
NAME=$( basename "$NAME" )
}
}
# stdin is open, use stdin
[ -t 0 ] || stream_in=1
@@ -192,4 +199,3 @@ _get_file
_url "$NAME"
exit $?
}