#!/usr/bin/env python
"""Script to start Python Web DLMON backend daemon."""

import sys
from optparse import OptionParser

from pywebdlmon.main import App


def main(args=None):
    if args is None:
        args = sys.argv
    op = OptionParser()
    op.add_option("-m", "--match", action="store")
    op.add_option("-r", "--reject", action="store")
    op.add_option("-p", "--parameter-file", action="store", default=args[0])
    op.add_option("-P", "--port", action="store")
    op.add_option("-s", "--state-file", action="store")
    op.add_option("-v", "--verbose", dest="verbose", action="store_true")
    (options, args) = op.parse_args(args[1:])
    app = App()
    app.run(options)


if __name__ == '__main__':
    exit(main())

