]> git.mjollnir.org Git - scripts.git/commitdiff
added bin/p (paste script)
authorPenny Leach <penny@mjollnir.org>
Tue, 15 Sep 2009 08:41:50 +0000 (10:41 +0200)
committerPenny Leach <penny@mjollnir.org>
Tue, 15 Sep 2009 08:41:50 +0000 (10:41 +0200)
bin/p [new file with mode: 0755]

diff --git a/bin/p b/bin/p
new file mode 100755 (executable)
index 0000000..15b74de
--- /dev/null
+++ b/bin/p
@@ -0,0 +1,28 @@
+#!/bin/zsh
+#
+# func/p
+#
+# function to publish to a pastebin (using pastebinit)
+#
+# Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
+# Released under the terms of the Artistic Licence 2.0
+#
+# Source repository: git://git.madduck.net/etc/zsh.git
+#
+
+if [[ $# -gt 1 ]]; then
+  echo E: only one argument can be passed. >&2
+  exit 1
+fi
+
+PERMATAG=$USER
+PB=http://slexy.org
+PBIT="pastebinit -b $PB -a $USER"
+
+FILE=-
+[[ -n "$1" ]] && FILE="$1"
+
+URL=`eval $PBIT -i $FILE`
+
+firefox $URL
+print $URL