diff --git a/.local/bin/nc-share b/.local/bin/nc-share new file mode 120000 index 0000000..3ed6e74 --- /dev/null +++ b/.local/bin/nc-share @@ -0,0 +1 @@ +../share/scripts/nc-share.sh \ No newline at end of file diff --git a/.local/bin/share-file b/.local/bin/share-file deleted file mode 120000 index 2bf88f7..0000000 --- a/.local/bin/share-file +++ /dev/null @@ -1 +0,0 @@ -../share/scripts/nc-share-file.sh \ No newline at end of file diff --git a/.local/share/scripts/nc-share-text.sh b/.local/share/scripts/nc-share-text.sh index 7c61204..c35ad6e 100755 --- a/.local/share/scripts/nc-share-text.sh +++ b/.local/share/scripts/nc-share-text.sh @@ -20,7 +20,5 @@ 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" - + | awk -n -e '{print "https://pb.kapelle.org/"$1}' diff --git a/.local/share/scripts/nc-share.sh b/.local/share/scripts/nc-share.sh new file mode 100755 index 0000000..53258f7 --- /dev/null +++ b/.local/share/scripts/nc-share.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +set -e + +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +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) + + +if file -i -b "$FILENAME" | grep "text" &> /dev/null; then + $SCRIPTPATH/nc-share-text.sh "$FILENAME" +else + $SCRIPTPATH/nc-share-file.sh "$FILENAME" +fi +