From 57c17f4782913b0e8e96648b8b69641e9d2f4eec Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 12 Feb 2021 19:50:39 +0100 Subject: [PATCH] add dotfiles pastebin script --- .local/share/scripts/nc-share-text.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 .local/share/scripts/nc-share-text.sh diff --git a/.local/share/scripts/nc-share-text.sh b/.local/share/scripts/nc-share-text.sh new file mode 100755 index 0000000..7c61204 --- /dev/null +++ b/.local/share/scripts/nc-share-text.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +set -e + +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +source $XDG_CONFIG_HOME/nextcloud.config.sh + +if test -n "$1"; then + FILE_PATH=$1 +elif test ! -t 0; then + read -r FILE_PATH +else + >&2 echo "Provide a file" + exit 1 +fi + +FILENAME=$(basename $FILE_PATH) + +$SCRIPTPATH/nc-share-file.sh "$FILENAME" \ + | perl -n -e '/([a-zA-Z0-9]+)$/ && print $1' \ + | awk -n -e '{print "https://pb.kapelle.org/"$1}' \ + | xclip -i -selection "clipboard" + +