Hacker News new | ask | show | jobs
by imurray 2533 days ago
http://docopt.org/ — turns help text in a Python doc string into an argument parser.

After a doc string put:

    import docopt
    args = docopt.docopt(__doc__, version='0.0.1')
Edit: krapht points out there is now support for multiple languages: https://github.com/docopt
1 comments

I use Docopt now for every CLI script I write, using Docopt language ports. Skipping argument parsing boilerplate is so nice, not to mention now I don't have to remember how each different language is supposed to idiomatically parse CLI arguments.