summaryrefslogtreecommitdiffstats
path: root/fb-client
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-06-08 21:02:37 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-06-08 21:02:37 +0200
commita7a1208bcbde8e3ee62ad6ab824acbd266db200d (patch)
tree070c76cd8be2649594c548f634e52f9572505b5d /fb-client
parent3238835aaf16d42883bbb81880adc585d0bbe031 (diff)
downloadaur-packages-a7a1208bcbde8e3ee62ad6ab824acbd266db200d.tar.gz
aur-packages-a7a1208bcbde8e3ee62ad6ab824acbd266db200d.tar.xz
update
Signed-off-by: Florian Pritz <bluewind@xssn.at>
Diffstat (limited to 'fb-client')
-rw-r--r--fb-client/PKGBUILD8
-rw-r--r--fb-client/fb-0.6.180
2 files changed, 84 insertions, 4 deletions
diff --git a/fb-client/PKGBUILD b/fb-client/PKGBUILD
index 73180b9..436bae1 100644
--- a/fb-client/PKGBUILD
+++ b/fb-client/PKGBUILD
@@ -1,12 +1,12 @@
# Contributor: Florian "Bluewind" Pritz <flo@xssn.at>
pkgname=fb-client
-pkgver=0.5.3
+pkgver=0.6.1
pkgrel=1
pkgdesc="Client for paste.xinu.at"
arch=('any')
url="http://paste.xinu.at"
license=('custom:WTFPLv2')
-depends=('python' 'curl')
+depends=('curl')
optdepends=('xclip: for automatically copying the URL into the clipboard')
source=("http://paste.xinu.at/data/client/fb-${pkgver}" "http://paste.xinu.at/data/client/COPYING")
@@ -17,7 +17,7 @@ build() {
}
# vim:set ts=2 sw=2 et:
-md5sums=('8e4b27a72c7c417008a9fc760af7eff4'
+md5sums=('5686e5a439f098a5d724f0cd399cf98e'
'dcd8c4d69ca6c3eba9bee2599456e4ac')
-sha1sums=('62a70848de573ab3b6b768509018f68f5cf2f32b'
+sha1sums=('af245f1462a78c3f9d35950b43e4f8ff757d26a9'
'497e6c7df473efe197c4f1450348dd0e893c706e')
diff --git a/fb-client/fb-0.6.1 b/fb-client/fb-0.6.1
new file mode 100644
index 0000000..06dd87e
--- /dev/null
+++ b/fb-client/fb-0.6.1
@@ -0,0 +1,80 @@
+#!/bin/bash
+#----------------------------------------------------
+# Author: Florian "Bluewind" Pritz <flo@xssn.at>
+#
+# Licensed under WTFPL v2
+# (see COPYING for full license text)
+#
+#----------------------------------------------------
+# only works if useragent contains libcurl
+# Dependencies: curl
+# Optional: xclip
+#----------------------------------------------------
+
+VERSION="0.6.1"
+
+DELETE=0
+EXTENSION=""
+GET=0
+PASTEBIN="http://paste.xinu.at"
+
+do_upload() {
+ local EXTRA=""
+ if [[ -n $EXTENSION ]]; then
+ EXTRA="-F extension=$EXTENSION"
+ fi
+ URL="$(curl -# -n -L $EXTRA -F "file=@$1" "$PASTEBIN/file/do_upload")"
+ echo $URL
+ echo -n "$URL" | nohup &> /dev/null xclip
+}
+
+read_stdin() {
+ if tty -s; then
+ echo "^C to exit, ^D to send"
+ fi
+ cat > "$1"
+}
+
+help() {
+ echo "fb-client version $VERSION"
+ echo "usage: [cat |] $(basename "$0") [switches] [file(s)|ID(s)]"
+ echo " Upload/nopaste file/stdin to paste.xinu.at and copy URL to clipboard."
+ echo " ~/.netrc: machine paste.xinu.at password PASSWORD"
+ echo ""
+ echo "Switches:"
+ echo " -e EXTENSION extension for default highlighting (e.g. \"diff\")"
+ echo " -d delete the IDs"
+ echo " -g download the IDs and output on stdout (use with care!)"
+ echo " -h this help"
+ exit 0
+}
+
+while getopts ":e:gdh" OPTION; do
+ case $OPTION in
+ e) EXTENSION="$OPTARG";;
+ g) GET=1;;
+ d) DELETE=1;;
+ h) help;;
+ \?) echo "unknown option \"-$OPTARG\"" >&2; exit 1;;
+ :) echo "Option \"-$OPTARG\" needs an argument" >&2; exit 1;;
+ esac
+done
+
+shift $((OPTIND - 1))
+
+TMPDIR="$(mktemp -d "/tmp/fb.XXXXXX")"
+
+if (($# == 0)); then
+ read_stdin "$TMPDIR/stdin"
+ do_upload "$TMPDIR/stdin"
+else
+ for i in "$@"; do
+ if [[ $DELETE == 1 ]]; then
+ curl -n -L "$PASTEBIN/file/delete/$i"
+ elif [[ $GET == 1 ]]; then
+ curl -s -o - "$PASTEBIN/$i"
+ else
+ do_upload $i
+ fi
+ done
+fi