changeset 2:164af2a4d291

better description formatting
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 19 Apr 2010 15:17:08 -0700
parents 820beace15f2
children 6ef0e769248d
files stampit/main.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stampit/main.py	Mon Apr 19 14:54:47 2010 -0700
+++ b/stampit/main.py	Mon Apr 19 15:17:08 2010 -0700
@@ -11,13 +11,17 @@
 
 import sys
 
-from optparse import OptionParser
+from optparse import OptionParser, IndentedHelpFormatter, HelpFormatter
 from subprocess import call
 
+class UnformattedDescription(IndentedHelpFormatter):
+    def format_description(self, description):
+        return description.strip() or ''
 
 def main(args=sys.argv[1:]):
     usage = '%prog [options] <package> <platform>'
-    parser = OptionParser(usage, description=globals()['__doc__'])
+    parser = OptionParser(usage, description=globals()['__doc__'],
+                          formatter=UnformattedDescription())
     parser.add_option('--version',
                       help='version of the package to be installed (defaults to the current on the cheeseshop)')
     options, args = parser.parse_args(args)