#!/usr/bin/env python3

"""run_server wraps gen_server with default values."""

import cmd


def server(port, directory):
    """
    server starts server listening on port in directory.
    """
    tmpl = 'gen_server --port {} --directory {}'
    for line in cmd.run(tmpl.format(port, directory)):
        print(line)


if __name__ == '__main__':
    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('--port', help='port to listen on', default=':3000')
    parser.add_argument('--directory', help='directory to start server in',
            default='build')
    args = parser.parse_args()
    server(args.port, args.directory)
