Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Demo application for the docopt and cmd python modules implementing a command-line interface to github gists

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Writing Command Line Tools in Python

The following are my notes for the talk on writing command line applications given to PhillyPUG on July 10, 2013.

Usage Strings

  • uses existing unix conventions (posix!)

Argument Parsing

  • optparse
  • argparse
  • docopt


  • automatic argument parsing
  • help comes for free
  • arguments
  • options
  • commands
    • constant strings
  • Separate options definitions
  • Vladimir Keleshev

Shelling Out

  • Writing Interactive Applications
  • use the cmd module


  • python standard library
  • subclass Cmd
  • set a prompt
  • define operations with do_ functions
  • docstrings become command help
  • help comes for free (again!)


Something went wrong with that request. Please try again.