From e91393f63c20e20c50ce62ceceba75f6c15e1481 Mon Sep 17 00:00:00 2001 From: Gunwant Jain Date: Tue, 18 Jan 2022 10:19:28 +0530 Subject: [PATCH] cli client: update and move to contrib Signed-off-by: Gunwant Jain --- Dockerfile | 2 +- client | 10 ---------- contrib/cli/client | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 11 deletions(-) delete mode 100755 client create mode 100755 contrib/cli/client diff --git a/Dockerfile b/Dockerfile index 19cee2a..cce2ef8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN cargo clean ###### Runner Image FROM scratch as runner COPY --from=builder /app/empty_upload upload -COPY ./client upload/client +COPY ./contrib/cli/client upload/client COPY ./templates templates COPY ./static static COPY ./themes themes diff --git a/client b/client deleted file mode 100755 index 416ef4c..0000000 --- a/client +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -url="http://127.0.0.1:8000" -filepath="$1" -filename=$(basename -- "$filepath") -extension="${filename##*.}" - -response=$(curl --data-binary @${filepath:-/dev/stdin} --url $url) -echo "$url$response"".""$extension" | tee >(xclip -selection clipboard) - diff --git a/contrib/cli/client b/contrib/cli/client new file mode 100755 index 0000000..dfd7170 --- /dev/null +++ b/contrib/cli/client @@ -0,0 +1,15 @@ +#!/bin/bash + +# Change the url accordingly +URL="https://bin.wantguns.dev" + +FILEPATH="$1" +FILENAME=$(basename -- "$FILEPATH") +EXTENSION="${FILENAME##*.}" + +RESPONSE=$(curl --data-binary @${FILEPATH:-/dev/stdin} --url $URL) +PASTELINK="$URL$RESPONSE" + +[ -z "$EXTENSION" ] && \ + echo "$PASTELINK" || \ + echo "$PASTELINK.$EXTENSION"