commit d69d2c4d230748f725cc7f0ee36b96948a316a2f
parent 7168999dfed01c495d6e1db0321eeb5306a56874
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu, 27 Feb 2020 21:24:03 +0100
Add option to send upload url to clipboard
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/.local/bin/upload b/.local/bin/upload
@@ -24,6 +24,7 @@ show_help() {
 	echo "   -V, --version  show version and license information"
 	echo "   -v, --verbose  show verbose information (e.g. upload progress)"
 	echo "   -n, --notify   also show diagnostic output with notify-send"
+	echo "   -c, --clip     send upload url to clipboard"
 	echo "   --             do not consider any following arguments as options"
 	echo "   -b, --border   if an image, add a 10% white border to FILES"
 	echo "   -r, --resize   if an image, resize FILES to fit 800x800 pixels"
@@ -122,6 +123,7 @@ upload_file() {
 		printf '%s\n' "$url"
 	fi
 	[ "$notify" = 1 ] && notify-send "$msg" || :
+	[ "$clip" = 1 ] && printf '%s' "$url" | xclip -i || :
 }
 
 download_file() {
@@ -151,6 +153,7 @@ die() {
 	exit 1
 }
 
+clip=0
 notify=0
 border=0
 resize=0
@@ -176,6 +179,9 @@ while :; do
 		-n|--notify)
 			notify=1
 			;;
+		-c|--clip)
+			clip=1
+			;;
 		-b|--border)
 			border=1
 			;;