]>
gitweb.michael.orlitzky.com - dead/census-tools.git/blob - src/CLI.py
1 from optparse
import IndentedHelpFormatter
2 from optparse
import OptionParser
4 import Configuration
.Defaults
7 def default_option_parser(usage
=None):
8 # -h (help) Conflicts with -h HOSTNAME
9 parser
= OptionParser(usage
=usage
, add_help_option
= False)
11 parser
.add_option('-h',
13 help='The hostname/address where the database is located.',
14 default
=Configuration
.Defaults
.DATABASE_HOST
)
16 parser
.add_option('-d',
18 help='The database in which the population data are stored.',
19 default
=Configuration
.Defaults
.DATABASE_NAME
)
21 parser
.add_option('-U',
23 help='The username who has access to the database.',
24 default
=Configuration
.Defaults
.DATABASE_USERNAME
)
30 class VerbatimHelpFormatter(IndentedHelpFormatter
):
32 The two HelpFormatters supplied with OptParse like to mangle their
33 descriptions during print_help(). This subclassed formatter
34 overrides the format_description() method with an implementation
35 that simply returns the description unmodified.
37 def format_description(self
, description
):