changeset 130:d9201f911458

better description formatting
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 01 Aug 2011 21:58:15 -0700
parents 57834c2b0937
children 4922bee3d080
files makeitso/python_module/{{module}}.py makeitso/python_package/{{package}}/main.py setup.py
diffstat 3 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/makeitso/python_module/{{module}}.py	Fri Jul 08 10:43:48 2011 -0700
+++ b/makeitso/python_module/{{module}}.py	Mon Aug 01 21:58:15 2011 -0700
@@ -5,13 +5,22 @@
 """
 
 import sys
-from optparse import OptionParser
+import optparse
 
 def main(args=sys.argv[1:]):
 
     # parse command line arguments
     usage = '%prog [options] ...'
-    parser = OptionParser(usage=usage, description=__doc__)
+
+    # description formatter
+    class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
+        def format_description(self, description):
+            if description:
+                return description + '\n'
+            else:
+                return ''
+    
+    parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
     options, args = parser.parse_args(args)
 
 if __name__ == '__main__':
--- a/makeitso/python_package/{{package}}/main.py	Fri Jul 08 10:43:48 2011 -0700
+++ b/makeitso/python_package/{{package}}/main.py	Mon Aug 01 21:58:15 2011 -0700
@@ -5,11 +5,22 @@
 """
 
 import sys
-from optparse import OptionParser
+import optparse
 
 def main(args=sys.argv[:]):
+
+  # parse command line options
   usage = '%prog [options]'
-  parser = OptionParser(usage=usage, description=__doc__)
+
+  # description formatter
+  class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
+    def format_description(self, description):
+      if description:
+        return description + '\n'
+      else:
+        return ''
+  
+  parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
   options, args = parser.parse_args(args)
 
 if __name__ == '__main__':
--- a/setup.py	Fri Jul 08 10:43:48 2011 -0700
+++ b/setup.py	Mon Aug 01 21:58:15 2011 -0700
@@ -7,7 +7,7 @@
 except IOError:
     description = ''
 
-version = '0.2.2'
+version = '0.2.3'
 
 setup(name='MakeItSo',
       version=version,