facebook/tornado — pull request #404 by jparise (2011-11-26 18:02:20+00:00)
Title: Improve option help formatting.

This approach to formatting option help text mimics the behavior of
the standard optparse module.

In general, we now attempt to align help text starting at column 30,
wrapping longer strings at the console's width. Options with
exceptionally long prefixes start their help text on the following
line instead.

We attempt to determine the console's width using a small helper
routine wrapping a TIOCGWINSZ ioctl() call (Unix-only). optparse
simply looks for the COLUMNS environmental variable, but that approach
is less reliable (albeit simpler). We default to 80 columns if we
can't otherwise determine the console's width.