@main.command()<EOL>@argument('<STR_LIT>', default='<STR_LIT>')<EOL>@option('<STR_LIT>', '<STR_LIT>', help="<STR_LIT>", default=<NUM_LIT>)<EOL>@option('<STR_LIT:-c>', '<STR_LIT>', default=_DEFAULT_CONFIG_FILE,<EOL>show_default=True, help='<STR_LIT>')<EOL>def serve(destination, port, config):
if os.path.exists(destination):<EOL><INDENT>pass<EOL><DEDENT>elif os.path.exists(config):<EOL><INDENT>settings = read_settings(config)<EOL>destination = settings.get('<STR_LIT>')<EOL>if not os.path.exists(destination):<EOL><INDENT>sys.stderr.write("<STR_LIT>"<EOL>"<STR_LIT>".format(destination))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>sys.stderr.write("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(destination=destination, config=config))<EOL>sys.exit(<NUM_LIT:2>)<EOL><DEDENT>print('<STR_LIT>'.format(destination))<EOL>os.chdir(destination)<EOL>Handler = server.SimpleHTTPRequestHandler<EOL>httpd = socketserver.TCPServer(("<STR_LIT>", port), Handler, False)<EOL>print("<STR_LIT>".format(port))<EOL>try:<EOL><INDENT>httpd.allow_reuse_address = True<EOL>httpd.server_bind()<EOL>httpd.server_activate()<EOL>httpd.serve_forever()<EOL><DEDENT>except KeyboardInterrupt:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>
Run a simple web server.