From 34556a43e5ba2725e00ce097dd2a1cfd3bf21e9e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 10 Nov 2009 19:31:13 -0500 Subject: [PATCH] Added the CLI module with a default_option_parser() function. --- src/CLI.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/CLI.py diff --git a/src/CLI.py b/src/CLI.py new file mode 100644 index 0000000..eb8b219 --- /dev/null +++ b/src/CLI.py @@ -0,0 +1,25 @@ +from optparse import OptionParser + +import Configuration.Defaults + + +def default_option_parser(usage): + # -h (help) Conflicts with -h HOSTNAME + parser = OptionParser(usage=usage, add_help_option = False) + + 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) + + return parser -- 2.43.2