Convert to docopt for commandline parsing

And also do a bit of clean up while I'm at it.

This is driven by wanting to add some extra commands around managing the names in the database - import and export to text files, and maybe reporting on duplicates that have sneaked in.  And thinking about trying to add them using argparse doesn't make me feel nice and fuzzy ...

[docopt](http://docopt.org) is much nicer - just write your doc string and have the code do the rest - so I've gone with that.

I then got into a bit of refactoring while I was at it ... Let me know if the refactoring is too aggressive or you'd like the changes broken down into more granular commits.