zephyr_mirror: Simplify optparse usage.

(imported from commit d7cce4236dae6f369ea1cc4e12f89c2011718b7f)
This commit is contained in:
Tim Abbott 2012-11-26 17:43:59 -05:00
parent ebf009b232
commit 333573f06b

View file

@ -669,63 +669,46 @@ def configure_logger(direction_name):
def parse_args(): def parse_args():
parser = optparse.OptionParser() parser = optparse.OptionParser()
parser.add_option('--forward-class-messages', parser.add_option('--forward-class-messages',
dest='forward_class_messages',
default=False, default=False,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store_true') action='store_true')
parser.add_option('--resend-log', parser.add_option('--resend-log',
dest='resend_log_path', dest='resend_log_path',
default=None, help=optparse.SUPPRESS_HELP)
help=optparse.SUPPRESS_HELP,
action='store')
parser.add_option('--enable-log', parser.add_option('--enable-log',
dest='log_path', dest='log_path',
default=None, help=optparse.SUPPRESS_HELP)
help=optparse.SUPPRESS_HELP,
action='store')
parser.add_option('--no-forward-personals', parser.add_option('--no-forward-personals',
dest='forward_personals', dest='forward_personals',
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
default=True, default=True,
action='store_false') action='store_false')
parser.add_option('--forward-from-humbug', parser.add_option('--forward-from-humbug',
dest='forward_from_humbug',
default=False, default=False,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store_true') action='store_true')
parser.add_option('--verbose', parser.add_option('--verbose',
dest='verbose',
default=False, default=False,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store_true') action='store_true')
parser.add_option('--sync-subscriptions', parser.add_option('--sync-subscriptions',
dest='sync_subscriptions',
default=False, default=False,
action='store_true') action='store_true')
parser.add_option('--site', parser.add_option('--site',
dest='site',
default=DEFAULT_SITE, default=DEFAULT_SITE,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP)
action='store')
parser.add_option('--user', parser.add_option('--user',
dest='user',
default=os.environ["USER"], default=os.environ["USER"],
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP)
action='store')
parser.add_option('--root-path', parser.add_option('--root-path',
dest='root_path',
default="/afs/athena.mit.edu/user/t/a/tabbott/for_friends", default="/afs/athena.mit.edu/user/t/a/tabbott/for_friends",
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP)
action='store')
parser.add_option('--test-mode', parser.add_option('--test-mode',
dest='test_mode',
default=False, default=False,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store_true') action='store_true')
parser.add_option('--api-key-file', parser.add_option('--api-key-file',
dest='api_key_file', default=os.path.join(os.environ["HOME"], "Private", ".humbug-api-key"))
default=os.path.join(os.environ["HOME"], "Private", ".humbug-api-key"),
action='store')
return parser.parse_args() return parser.parse_args()
if __name__ == "__main__": if __name__ == "__main__":