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

@@ -14,7 +14,7 @@ from utils.utils import *
from utils.crypt import * from utils.crypt import *
__FLEES_VERSION__ = "20180918.0" __FLEES_VERSION__ = "20180919.0"
app = Flask(__name__) app = Flask(__name__)
app.config.from_object(__name__) app.config.from_object(__name__)
config_values = read_config(app) config_values = read_config(app)

View File

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