From 6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Tue, 18 Aug 2015 02:38:33 +0200 Subject: Organise everything systematically. --- Window_Manager/ratpoison/sprunge | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 Window_Manager/ratpoison/sprunge (limited to 'Window_Manager/ratpoison/sprunge') diff --git a/Window_Manager/ratpoison/sprunge b/Window_Manager/ratpoison/sprunge new file mode 100755 index 0000000..a6e89a4 --- /dev/null +++ b/Window_Manager/ratpoison/sprunge @@ -0,0 +1,62 @@ +#!/bin/bash + +usage() { +description | fmt -s >&2 +} + +description() { +cat << HERE + +DESCRIPTION + Upload data and fetch URL from the pastebin http://sprunge.us + +USAGE + $0 filename.txt + $0 text string + $0 < filename.txt + piped_data | $0 + +NOTES +-------------------------------------------------------------------------- +* INPUT METHODS * +$0 can accept piped data, STDIN redirection [&2 + if [ "$*" ]; then + echo Arguments present... >&2 + if [ -f "$*" ]; then + echo Uploading the contents of "$*"... >&2 + cat "$*" + else + echo Uploading the text: \""$*"\"... >&2 + echo "$*" + fi | curl -F 'sprunge=<-' http://sprunge.us | xclip + else + echo No arguments found, will upload clipboard, also printing USAGE and exiting. >&2 + xclip -o | curl -F 'sprunge=<-' http://sprunge.us | xclip + notify-send Uploaded clipboard to sprunge + usage + fi +else + echo Using input from a pipe or STDIN redirection... >&2 + while read -r line ; do + echo $line + done | curl -F 'sprunge=<-' http://sprunge.us | xclip +fi -- cgit v1.2.3-54-g00ecf