Compare commits

...

2 Commits

Author SHA1 Message Date
9b357d7d82 image support for nc-share.sh 2021-03-07 01:14:36 +01:00
425e4f2bdc improved nc share 2021-03-07 01:09:00 +01:00
4 changed files with 28 additions and 4 deletions

1
.local/bin/nc-share Symbolic link
View File

@@ -0,0 +1 @@
../share/scripts/nc-share.sh

View File

@@ -1 +0,0 @@
../share/scripts/nc-share-file.sh

View File

@@ -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}'

View File

@@ -0,0 +1,26 @@
#!/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"
elif file -i -b "$FILENAME" | grep "image" &> /dev/null; then
$SCRIPTPATH/nc-share-file.sh "$FILENAME" | awk '{print $1"/preview"}'
else
$SCRIPTPATH/nc-share-file.sh "$FILENAME"
fi