import argparse
import sys

from . import app


def get_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('--host', dest='host', required=False, default='0.0.0.0', help='Bind host/address')
    parser.add_argument('--port', dest='port', required=False, type=int, default=8000, help='Bind port (default: 8000)')
    parser.add_argument('--debug', dest='debug', required=False, action='store_true', default=False,
                        help='Enable debug mode (default: False)')

    return parser.parse_known_args(sys.argv[1:])


opts = get_args()[0]
app.run(host=opts.host, port=opts.port, debug=opts.debug)
