You're right - looking on the http://docopt.org/ page it's not immediately obvious how it works.
The general idea is that you don't specify any code, you just give the help message as text. Docopt parses that to figure out all the options etc and convert those into the parameters coming in to your system.
It's a really clever idea. You specify the human interface, docopt converts that into the code version (so long as you adhere to a few common conventions). I haven't seen a cleaner system anywhere.
I could use it for simple cases within 15 seconds of reading. Docopt not so much.