bin bash curl http dumpz org grep option sed option value fmt lexers a

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# curl http://dumpz.org/ | grep option | sed 's/.*option value="\([^"]*\)".*/\1/' | fmt
lexers=(
apacheconf bash bat bbcode befunge boo brainfuck c cpp csharp css
css+django css+erb css+genshitext css+mako css+myghty css+php css+smarty
d delphi diff django dylan erb genshi genshitext groff haskell html
html+django html+genshi html+mako html+myghty html+php html+smarty ini
irc java js js+django js+erb js+genshitext js+mako js+myghty js+php
js+smarty jsp lua make mako minid mupad myghty objective-c ocaml perl
php pycon pytb python raw rb rbcon redcode rhtml rst scheme smarty
sourceslist sql tex text trac-wiki vb.net vim xml xml+django xml+erb
xml+mako xml+myghty xml+php xml+smarty
)
if [ -n "$1" ]; then
use_lexer=""
for lexer in "${lexers[@]}"; do
if [ "$1" == "$lexer" ]; then
use_lexer="$1"
break
fi
done
if [ -z "$use_lexer" ]; then
echo "Unknown lexer: $1" 1>&2
exit 1
fi
else
use_lexer="text"
fi
exec curl --include \
--form "code=<-" \
--form "lexer=$use_lexer" \
--form "tags=" \
http://dumpz.org/add/