From: Michael Orlitzky Date: Mon, 16 Nov 2009 01:38:05 +0000 (-0500) Subject: Modified the default_option_parser function to return a parser using a VerbatimHelpFo... X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=c498de425990074f93306b066a48400739b6d38a;p=dead%2Fcensus-tools.git Modified the default_option_parser function to return a parser using a VerbatimHelpFormatter. Updated the scripts using default_option_parser to account for the whitespace changes. --- diff --git a/bin/blocks2kml b/bin/blocks2kml index bef23fa..78420c9 100755 --- a/bin/blocks2kml +++ b/bin/blocks2kml @@ -33,7 +33,7 @@ to stdout. parser = CLI.default_option_parser() # Use this module's docstring as the description. -parser.description = __doc__.strip() +parser.description = __doc__ (options, args) = parser.parse_args() diff --git a/bin/drag_wkt_along_kml_path b/bin/drag_wkt_along_kml_path index c65c34a..aa27466 100755 --- a/bin/drag_wkt_along_kml_path +++ b/bin/drag_wkt_along_kml_path @@ -28,7 +28,7 @@ usage = '%prog [options] ' parser = CLI.default_option_parser(usage) # Use this module's docstring as the description. -parser.description = __doc__.strip() +parser.description = __doc__ parser.add_option('-o', '--outfile', diff --git a/bin/find_avg_population_density b/bin/find_avg_population_density index ef60d22..42ed3e5 100755 --- a/bin/find_avg_population_density +++ b/bin/find_avg_population_density @@ -41,7 +41,7 @@ usage = '%prog [options] ' parser = CLI.default_option_parser(usage) # Use this module's docstring as the description. -parser.description = __doc__.strip() +parser.description = __doc__ parser.add_option('-s', '--srid', diff --git a/bin/lines2kml b/bin/lines2kml index 3fc3d78..0e23942 100755 --- a/bin/lines2kml +++ b/bin/lines2kml @@ -30,7 +30,7 @@ to stdout. parser = CLI.default_option_parser() # Use this module's docstring as the description. -parser.description = __doc__.strip() +parser.description = __doc__ parser.add_option('-s', '--state', diff --git a/bin/wkt2kml b/bin/wkt2kml index 81b45ff..7735bb7 100755 --- a/bin/wkt2kml +++ b/bin/wkt2kml @@ -3,9 +3,7 @@ """ Convert an OGC Well-Known Text string to a Keyhole Markup Language (KML) file. -""" -""" We take a Well-Known Text[1] string as input, and optionally a filename to which to write the output. While we shouldn't technically *need* access to a PostGIS database to perform this conversion, it @@ -48,7 +46,7 @@ e.g. see the object name in Google Earth. parser = CLI.default_option_parser() # Use this module's docstring as the description. -parser.description = __doc__.strip() +parser.description = __doc__ parser.add_option('-o', '--outfile', diff --git a/bin/wkt2pop b/bin/wkt2pop index 3fa70b2..89bb595 100755 --- a/bin/wkt2pop +++ b/bin/wkt2pop @@ -2,9 +2,7 @@ """ Find the total population contained within a geometric object. -""" -""" Our input is an OGC Well-Known Text[1] string. This string is used as part of a database query that finds the population contained within (i.e. 'underneath') the geometric object corresponding to the WKT @@ -30,7 +28,7 @@ usage = '%prog [options] ' parser = CLI.default_option_parser(usage) # Use this module's docstring as the description. -parser.description = __doc__.strip() +parser.description = __doc__ parser.add_option('-s', diff --git a/src/CLI.py b/src/CLI.py index 4da436e..93ac2a0 100644 --- a/src/CLI.py +++ b/src/CLI.py @@ -5,8 +5,14 @@ import Configuration.Defaults def default_option_parser(usage=None): + # Use a VerbatimFormatter instead of the default + # IndentedHelpFormatter. + fmtr = VerbatimHelpFormatter() + # -h (help) Conflicts with -h HOSTNAME - parser = OptionParser(usage=usage, add_help_option = False) + parser = OptionParser(usage = usage, + add_help_option = False, + formatter = fmtr) parser.add_option('-h', '--host',