]> gitweb.michael.orlitzky.com - dead/census-tools.git/blobdiff - bin/find_avg_population_density
Set a default usage=None for the CLI.default_option_parser() function.
[dead/census-tools.git] / bin / find_avg_population_density
index 712db20f96c3c53465d1b8131826cb37547fb88d..ef60d22df439add2308d6951f98252d86ca0612a 100755 (executable)
@@ -7,13 +7,13 @@ Find the average population density of a set of GPS coordinates.
 import sys
 import os
 import site
-from optparse import OptionParser
 
 # Basically, add '../src' to our path.
 # Needed for the imports that follow.
 site.addsitedir(os.path.dirname(os.path.abspath(sys.argv[0])) + '/../src')
 
 import Census
+import CLI
 import Configuration.Defaults
 import ExitCodes
 import GPS
@@ -38,27 +38,11 @@ for idx, value in enumerate(sys.argv):
     
 usage = '%prog [options] <longitude> <latitude>'
 
-# -h (help) Conflicts with -h HOSTNAME
-parser = OptionParser(usage=usage, add_help_option = False)
+parser = CLI.default_option_parser(usage)
 
 # Use this module's docstring as the description.
 parser.description = __doc__.strip()
 
-parser.add_option('-h',
-                  '--host',
-                  help='The hostname/address where the database is located.',
-                  default=Configuration.Defaults.DATABASE_HOST)
-
-parser.add_option('-d',
-                  '--database',
-                  help='The database in which the population data are stored.',
-                  default=Configuration.Defaults.DATABASE_NAME)
-
-parser.add_option('-U',
-                  '--username',
-                  help='The username who has access to the database.',
-                  default=Configuration.Defaults.DATABASE_USERNAME)
-
 parser.add_option('-s',
                   '--srid',
                   type="int",