def command_line_options(): """ command line configuration """ parser = OptionParser(usage="usage: %prog [options] <config_file>") parser.add_option('-d', '--debug', action="store_true", dest="debug", default=False, help="Start the application in debugging mode.") parser.add_option('-p', '--port', action="store", dest="port", default=8000, help="Set the port to listen to on startup.") parser.add_option('-a', '--address', action="store", dest="address", default=None, help="Set the address to listen to on startup. Can be a " "hostname or an IPv4/v6 address.") parser.add_option('-l', '--level', action="store", choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], dest="log_level", default='INFO', help="Set the log level. Logging messages which are less" " severe than the specified level will not be logged.") options, args = parser.parse_args() # load the optional configuration file, if given if len(args) >= 1: config.load_file(args[0]) else: config.load_file('application/config/config.yaml') return options
def command_line_options(): """ command line configuration """ parser = OptionParser(usage="usage: %prog [options] <config_file>") parser.add_option('-d', '--debug', action="store_true", dest="debug", default=False, help="Start the application in debugging mode.") parser.add_option('-p', '--port', action="store", dest="port", default=3000, help="Set the port to listen to on startup.") parser.add_option('-a', '--address', action="store", dest="address", default=None, help="Set the address to listen to on startup. Can be a " "hostname or an IPv4/v6 address.") parser.add_option('-m', '--mock', action="store_true", dest="mock", default=False, help="Only use Mock (fake) data") options, args = parser.parse_args() if len(args) >= 1: config.load_file(args[0]) return options