summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Ørsted Andresen <bo.andresen@zlin.dk>2007-09-19 08:10:59 +0000
committerBo Ørsted Andresen <bo.andresen@zlin.dk>2007-09-19 08:10:59 +0000
commit17ac3955cea5ef42747b00d7bee6b88c4b0d5c00 (patch)
tree0678677826577956d916f532a3608643aec6314c
parent72d31f0fc0f8899be9aa5c8910e1cbfaebbeb026 (diff)
downloadwgetpaste-17ac3955cea5ef42747b00d7bee6b88c4b0d5c00.tar.gz
Add support for tinyurl.
-rwxr-xr-xwgetpaste14
1 files changed, 13 insertions, 1 deletions
diff --git a/wgetpaste b/wgetpaste
index 23a62b7..621fd6a 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -30,6 +30,9 @@ URL_osl="http://pastebin.osuosl.org/ pastebin.php"
# sh
ENGINE_sh=sh
URL_sh="http://sh.nu/p/"
+# tinyurl
+ENGINE_tinyurl=tinyurl
+URL_tinyurl="http://tinyurl.com/ create.php"
### engines
# ca
@@ -63,6 +66,9 @@ POST_osl="paste=Send poster % format expiry % code2"
REGEX_RAW_osl='s|^\(http://[^/]\+/\)\([0-9]\+\)$|\1pastebin.php?dl=\2|'
# sh
POST_sh="% poster % % % % code"
+# tinyurl
+POST_tinyurl="submit=Make+TinyURL! % % % % % url"
+REGEX_URL_tinyurl='s|^<input type=hidden name=tinyurl value="\?\([^"]\+\)"\?>$|\1|p'
### errors
die() {
@@ -239,6 +245,8 @@ Options:
-L, --list-languages list languages supported by the specified service
-E, --list-expiration list expiration setting supported by the specified service
+ -T, --tinyurl URL convert input url to tinyurl
+
-c, --command COMMAND paste COMMAND and the output of COMMAND
-i, --info append the output of \`$INFO_COMMAND\`
-I, --info-only paste the output of \`$INFO_COMMAND\` only
@@ -327,7 +335,7 @@ x_paste() {
# get the url to post to
getrecipient() {
local urls target serv
- for s in $SERVICES; do
+ for s in $SERVICES tinyurl; do
if [[ $s == $SERVICE ]]; then
urls=URL_$SERVICE
if [[ RAW == $1 ]]; then
@@ -487,6 +495,10 @@ while [[ -n $1 ]]; do
TEE=0
shift
;;
+ -T | --tinyurl )
+ SERVICE=tinyurl
+ shift
+ ;;
-v | --verbose )
VERBOSE=0
shift