]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Added the VerbatimHelpFormatter class to the CLI module.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 13 Nov 2009 00:59:08 +0000 (19:59 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 13 Nov 2009 01:46:23 +0000 (20:46 -0500)
src/CLI.py

index b7fcaaff8e49fe8fb377fcdaed8c9cc61caf2938..4da436e9d0351a0d943897575c5887a5874c981c 100644 (file)
@@ -1,3 +1,4 @@
+from optparse import IndentedHelpFormatter
 from optparse import OptionParser
 
 import Configuration.Defaults
@@ -23,3 +24,15 @@ def default_option_parser(usage=None):
                       default=Configuration.Defaults.DATABASE_USERNAME)
 
     return parser
+
+
+
+class VerbatimHelpFormatter(IndentedHelpFormatter):
+    """
+    The two HelpFormatters supplied with OptParse like to mangle their
+    descriptions during print_help(). This subclassed formatter
+    overrides the format_description() method with an implementation
+    that simply returns the description unmodified.
+    """
+    def format_description(self, description):
+        return description