diff options
author | EuAndreh <eu@euandre.org> | 2022-06-02 15:02:59 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-06-02 15:03:01 -0300 |
commit | 0719ec219a8cbf8882d3e4ffaa504119585a2885 (patch) | |
tree | 2bf7f6ae81c2b45e73746be76715fbc4938a0d4b /src/bin | |
parent | src/development/genhtml.sh: Use relative URLs by default, with BASE_URL=/ (diff) | |
download | euandre.org-0719ec219a8cbf8882d3e4ffaa504119585a2885.tar.gz euandre.org-0719ec219a8cbf8882d3e4ffaa504119585a2885.tar.xz |
src/bin/tmp: Move out of repository, into ~/.usr/bin
Decouple it from this website, as it has nothing to do with it.
Diffstat (limited to '')
-rwxr-xr-x | src/bin/tmp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/bin/tmp b/src/bin/tmp deleted file mode 100755 index 80cadd9..0000000 --- a/src/bin/tmp +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - tmp FILE... - tmp -d - tmp -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -d delete the remote "tmp/" folder - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -TLD='euandre.org' -REMOTE_TMP='/home/user-data/www/default/tmp' -while getopts 'dh' flag; do - case "$flag" in - d) - printf 'Deleting %s:%s...\n' "$TLD" "$REMOTE_TMP/" >&2 - ssh "$TLD" rm -rf "$REMOTE_TMP" - exit - ;; - h) - usage - help - exit - ;; - *) - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -if [ -z "${1:-}" ]; then - usage >&2 - exit 2 -fi - -for f in "$@"; do - FILENAME="$(basename "$f")" - # shellcheck disable=2029 - ssh "$TLD" "mkdir -p '$REMOTE_TMP' && cat > '$REMOTE_TMP/$FILENAME'" < "$f" - - LINK="$(printf 'https://%s/tmp/%s' "$TLD" "$FILENAME")" - open "$LINK" - if [ $# = 1 ]; then - printf '%s' "$LINK" | copy - printf 'Copied %s to the clipboard!\n' "$LINK" >&2 - fi -done |