Build reliable command line tools
with `click`
Stefan Antoni @suchkultur
$> find ~/.virtualenvs -type f | grep ".*/site-packages/django/__init__.py$" | wc -l 8
$> echo $?
0
for great command line tools:
# listen on port 25, wait for an incoming connection, use CR+NL on this
# connection, relay data to and from stdio, then emulate
# a mailserver by hand :-)
socat - TCP-LISTEN:25,crlf
# Copy all *.txt files which contain "bob" to a new directory
find . -type f -name "*.txt" | grep 'bob' | xargs cp –target-directory=newDir
# Extract palindromes from a website and print them (i show you later)
curl "http://de.wikipedia.org/wiki/Liste_deutscher_Palindrome" -o - | ./palindrome.py - -
Click parses and dispatches
tighter coupling, more context
Click is "complete"
click is @fun()
./palindrome.py --help (click)