diff options
-rwxr-xr-x | wgetpaste | 50 |
1 files changed, 34 insertions, 16 deletions
@@ -56,10 +56,9 @@ show_url() { DEFAULT_NICK="${DEFAULT_NICK:-$(whoami)}" DEFAULT_SERVICE="${DEFAULT_SERVICE:-rafb}" DEFAULT_LANGUAGE="${DEFAULT_LANGUAGE:-Plain Text}" -DEFAULT_EXPIRATION="${DEFAULT_EXPIRATION:-1 week}" +DEFAULT_EXPIRATION="${DEFAULT_EXPIRATION:-1 month}" # setting DEFAULT_EXPIRATION_${SERVICE} can be used to override for services where the general # default is unavailable. -DEFAULT_EXPIRATION_stgraber="${DEFAULT_EXPIRATION_stgraber:-1 month}" ### usage @@ -92,9 +91,9 @@ show_usage() { ### services -SERVICES=(ca rafb sh stgraber) -SERVICE_URLS=(http://pastebin.ca http://rafb.net/paste/ http://sh.nu/p/ http://paste.stgraber.org) -SERVICE_URLS_RAW=(http://pastebin.ca http://rafb.net/paste/paste.php http://sh.nu/p/ http://paste.stgraber.org) +SERVICES=(ca rafb osl sh stgraber) +SERVICE_URLS=(http://pastebin.ca http://rafb.net/paste/ http://pastebin.osuosl.org/ http://sh.nu/p/ http://paste.stgraber.org) +SERVICE_URLS_RAW=(http://pastebin.ca http://rafb.net/paste/paste.php http://pastebin.osuosl.org/pastebin.php http://sh.nu/p/ http://paste.stgraber.org) # 4 (base indentation) + max service length + 2 (space + dash) INDENTATION=14 @@ -122,13 +121,23 @@ rafb_LANGUAGES=(C C89 C99 C++ C\# Java Pascal Perl PHP PL\/I Python Ruby SQL VB ca_LANGUAGES=(Plain_Text Asterisk_Configuration C C++ PHP Perl Java VB C\# Ruby Python Pascal \ mIRC PL/I XML SQL Scheme ActionScript Ada Apache_Configuration Assembly_\(NASM\) ASP Bash CSS \ Delphi HTML_6\.0_Strict JavaScript LISP Lua Microprocessor_ASM Objective_C VB\.NET) +# osl - ordering for languages and values must be the same +osl_LANGUAGES=(Plain_Text ActionScript Ada Apache_Log_File AppleScript Assembly_\(NASM\) \ +ASP Bash C C_for_Macs CAD_DCL CAD_Lisp C++ C\# ColdFusion CSS D Delphi Diff DOS Eiffel Fortran \ +FreeBasic Game_Maker HTML INI_file Java Javascript Lisp Lua MatLab Microprocessor_ASM MySQL \ +NullSoft_Installer Objective_C OCaml Openoffice\.org_BASIC Oracle_8 Pascal Perl PHP Python \ +QBasic\/QuickBASIC Robots Ruby Scheme Smarty SQL TCL VB VB\.NET VisualFoxPro XML) +osl_LANGUAGE_VALUES=(text actionscript ada apache applescript asm asp bash c c_mac caddcl \ +cadlisp cpp csharp cfm css d delphi diff dos eiffel fortran freebasic gml html4strict ini java \ +javascript lisp lua matlab mpasm mysql nsis objc ocaml oobas oracle8 pascal perl php python \ +qbasic robots ruby scheme smarty sql tcl vb vbnet visualfoxpro xml) # stgraber - ordering for languages and values must be the same stgraber_LANGUAGES=(Plain_Text ActionScript Ada Apache_Log_File AppleScript Assembly_\(NASM\) \ ASP Bash C C_for_Macs CAD_DCL CAD_Lisp C++ C\# ColdFusion CSS D Delphi Diff DOS Eiffel Fortran \ FreeBasic Game_Maker HTML INI_file Java Javascript Lisp Lua MatLab Microprocessor_ASM MySQL \ NullSoft_Installer Objective_C OCaml Openoffice\.org_BASIC Oracle_8 Pascal Perl PHP Python \ QBasic\/QuickBASIC Robots Ruby Scheme Smarty SQL TCL VB VB\.NET VisualFoxPro XML) -stgraber_LANGUAGE_VALUES=(text actionscript ada apache applescript asm asp bash c c\_mac caddcl \ +stgraber_LANGUAGE_VALUES=(text actionscript ada apache applescript asm asp bash c c_mac caddcl \ cadlisp cpp csharp cfm css d delphi diff dos eiffel fortran freebasic gml html4strict ini java \ javascript lisp lua matlab mpasm mysql nsis objc ocaml oobas oracle8 pascal perl php python \ qbasic robots ruby scheme smarty sql tcl vb vbnet visualfoxpro xml) @@ -136,7 +145,7 @@ qbasic robots ruby scheme smarty sql tcl vb vbnet visualfoxpro xml) show_languages() { echo "Languages supported by ${SERVICE}: $(get_recipient) (case sensitive):" case "${SERVICE}" in - ca | rafb | stgraber ) + ca | osl | rafb | stgraber ) for language in $(eval "echo \${${SERVICE}_LANGUAGES[*]}"); do echo " ${language//_/ }" done | sort @@ -162,10 +171,10 @@ verify_language() { [[ "${LANGUAGE}" == "${language//_/ }" ]] && return 0 done ;; - stgraber ) + osl | stgraber ) let "i = 0" - for language in ${stgraber_LANGUAGES[*]}; do - [[ "${LANGUAGE}" == "${language//_/ }" ]] && LANGUAGE="${stgraber_LANGUAGE_VALUES[i]}" && return 0 + for language in $(eval "echo \${${SERVICE}_LANGUAGES[*]}"); do + [[ "${LANGUAGE}" == "${language//_/ }" ]] && LANGUAGE="$(eval "echo \${${SERVICE}_LANGUAGE_VALUES[i]}")" && return 0 let "i = i + 1" done ;; @@ -182,6 +191,9 @@ verify_language() { ca_EXPIRATION_OPTIONS=(Never 5_minutes 10_minutes 15_minutes 30_minutes 45_minutes 1_hour 2_hours \ 4_hours 8_hours 12_hours 1_day 2_days 3_days 1_week 2_weeks 3_weeks 1_month 2_months 3_months \ 4_months 5_months 6_months 1_year) +# osl - ordering for options and values must be the same +osl_EXPIRATION_OPTIONS=(Never 1_day 1_month) +osl_EXPIRATION_VALUES=(f d m) # stgraber - ordering for options and values must be the same stgraber_EXPIRATION_OPTIONS=(Never 1_day 1_month) stgraber_EXPIRATION_VALUES=(f d m) @@ -189,7 +201,7 @@ stgraber_EXPIRATION_VALUES=(f d m) show_expiration_options() { echo "Expiration options supported by ${SERVICE}: $(get_recipient) (case sensisitive):" case "${SERVICE}" in - ca | stgraber ) + ca | osl | stgraber ) for expiration in $(eval "echo \${${SERVICE}_EXPIRATION_OPTIONS[*]}"); do echo " ${expiration//_/ }" done @@ -213,10 +225,10 @@ verify_expiration_options() { [[ "${EXPIRATION}" == "${expiration//_/ }" ]] && return 0 done ;; - stgraber ) + osl | stgraber ) let "i = 0" - for expiration in ${stgraber_EXPIRATION_OPTIONS[*]}; do - [[ "${EXPIRATION}" == "${expiration//_/ }" ]] && EXPIRATION="${stgraber_EXPIRATION_VALUES[i]}" && return 0 + for expiration in $(eval "echo \${${SERVICE}_EXPIRATION_OPTIONS[*]}"); do + [[ "${EXPIRATION}" == "${expiration//_/ }" ]] && EXPIRATION="$(eval "echo \${${SERVICE}_EXPIRATION_VALUES[i]}")" && return 0 let "i = i + 1" done ;; @@ -273,6 +285,9 @@ post_data() { ca ) echo "name=${NICK}&type=${LANGUAGE}&description=${DESCRIPTION}&expiry=${EXPIRATION}&s=Submit+Post&content=${INPUT}" ;; + osl ) + echo "poster=${NICK}&format=${LANGUAGE}&expiry=${EXPIRATION}&paste=Send&code2=${INPUT}" + ;; rafb ) echo "nick=${NICK}&lang=${LANGUAGE}&desc=${DESCRIPTION}&cvt_tabs=${CVT_TABS}&text=${INPUT}" ;; @@ -297,7 +312,7 @@ need_stdout() { return 0 ;; # these services read the reply from Location: which goes to stderr - rafb | sh | stgraber ) + osl | rafb | sh | stgraber ) return 1 ;; * ) @@ -313,7 +328,7 @@ get_url() { ca ) echo "$*" | sed -n 's|^.*content="[0-9]*;\(http://pastebin.ca/[0-9]*\)".*$|\1|p' ;; - rafb | sh | stgraber ) + osl | rafb | sh | stgraber ) echo "$*" | sed -n 's|^.*Location:\ \(http://[^\ ]\+\).*$|\1|p' ;; * ) @@ -341,6 +356,9 @@ convert_to_raw() { ca ) RAW_URL="$(echo "${URL}" | sed -e 's|^\(http://pastebin.ca/\)\(.*\)$|\1raw/\2|')" ;; + osl ) + RAW_URL="$(echo "${URL}" | sed -e 's|^\(http://pastebin.osuosl.org/\)\(.*\)$|\1pastebin.php?dl=\2|')" + ;; rafb ) RAW_URL="$(echo "${URL}" | sed -e 's|html\?$|txt|')" ;; |