Command-line entry point.

    :param arguments: List of strings that contain the command-line arguments.
       When ``None``, the command-line arguments are looked up in ``sys.argv``
       (``sys.argv[0]`` is ignored).
    :return: This function has no return value.
    :raise SystemExit: The command-line arguments are invalid.

def main(arguments=None):
    """Command-line entry point.

    :param arguments: List of strings that contain the command-line arguments.
       When ``None``, the command-line arguments are looked up in ``sys.argv``
       (``sys.argv[0]`` is ignored).
    :return: This function has no return value.
    :raise SystemExit: The command-line arguments are invalid.
    """

    # Parse command-line arguments.
    if arguments is None:
        arguments = sys.argv[1:]
    arguments = cli.parse_args(arguments)

    # Dynamic defaults.
    logging_endpoint = arguments.logging_endpoint
    if not logging_endpoint:
        logging_endpoint = os.environ.get('SMARTMOB_LOGGING_ENDPOINT')
    if not logging_endpoint:
        logging_endpoint = 'file:///dev/stdout'

    # Initialize logger.
    configure_logging(
        log_format=arguments.log_format,
        utc=arguments.utc_timestamps,
        endpoint=logging_endpoint,
    )
    event_log = structlog.get_logger()

    # Start the event loop.
    loop = asyncio.get_event_loop()

    # Run the agent :-)
    try:
        with responder(loop, event_log=event_log,
                       host=arguments.host,
                       port=arguments.port):
            loop.run_forever()  # pragma: no cover
    except KeyboardInterrupt:
        event_log.info('stop', reason='ctrl-c')