Consistent indention levels.

This commit is contained in:
Colin Shea 2011-11-27 02:53:44 -07:00
commit d8d7b45f96

View file

@ -3,11 +3,11 @@
# Original found at http://www.shellperson.net/sprunge-pastebin-script/ # Original found at http://www.shellperson.net/sprunge-pastebin-script/
usage() { usage() {
description | fmt -s >&2 description | fmt -s >&2
} }
description() { description() {
cat << HERE cat << HERE
DESCRIPTION DESCRIPTION
Upload data and fetch URL from the pastebin http://sprunge.us Upload data and fetch URL from the pastebin http://sprunge.us
@ -35,27 +35,28 @@ If a filename is misspelled or doesn't have the necessary path description, it w
-------------------------------------------------------------------------- --------------------------------------------------------------------------
HERE HERE
exit exit
} }
sprunge() { sprunge() {
if [ -t 0 ]; then if [ -t 0 ]; then
if [ "$*" ]; then if [ "$*" ]; then
if [ -f "$*" ]; then if [ -f "$*" ]; then
# Use python to attempt to detect the syntax # Use python to attempt to detect the syntax
syntax=$(echo "try: syntax=$(echo "
from pygments.lexers import get_lexer_for_filename try:
print(get_lexer_for_filename('$*').aliases[0]) from pygments.lexers import get_lexer_for_filename
except: print(get_lexer_for_filename('$*').aliases[0])
print('text')" | python) except:
cat "$*" | curl -F 'sprunge=<-' http://sprunge.us print('text')" | python)
fi cat "$*" | curl -F 'sprunge=<-' http://sprunge.us
else fi
usage else
fi usage
else fi
while read -r line ; do else
echo $line while read -r line ; do
done | curl -F 'sprunge=<-' http://sprunge.us echo $line
fi done | curl -F 'sprunge=<-' http://sprunge.us
fi
} }