| 1460 | |
| 1461 | |
| 1462 | def parse_args(args): |
| 1463 | parser = argparse.ArgumentParser(usage=usage_str) |
| 1464 | |
| 1465 | parser.add_argument('--kill-start', action='store_true', |
| 1466 | help='If true, any previously running instances of ' |
| 1467 | 'the target browser are killed before starting.') |
| 1468 | |
| 1469 | parser.add_argument('--kill-exit', action='store_true', |
| 1470 | help='If true, the spawned browser process is forcibly ' |
| 1471 | 'killed when it calls exit(). Note: Using this ' |
| 1472 | 'option may require explicitly passing the option ' |
| 1473 | '--browser=/path/to/browser, to avoid emrun being ' |
| 1474 | 'detached from the browser process it spawns.') |
| 1475 | |
| 1476 | parser.add_argument('--no-server', dest='run_server', action='store_false', |
| 1477 | default=True, |
| 1478 | help='If specified, a HTTP web server is not launched ' |
| 1479 | 'to host the page to run.') |
| 1480 | |
| 1481 | parser.add_argument('--no-browser', dest='run_browser', action='store_false', |
| 1482 | default=True, |
| 1483 | help='If specified, emrun will not launch a web browser ' |
| 1484 | 'to run the page.') |
| 1485 | |
| 1486 | parser.add_argument('--no-emrun-detect', action='store_true', |
| 1487 | help='If specified, skips printing the warning message ' |
| 1488 | 'if html page is detected to not have been built ' |
| 1489 | 'with --emrun linker flag.') |
| 1490 | |
| 1491 | parser.add_argument('--serve-after-close', action='store_true', |
| 1492 | help='If true, serves the web page even after the ' |
| 1493 | 'application quits by user closing the web page.') |
| 1494 | |
| 1495 | parser.add_argument('--serve-after-exit', action='store_true', |
| 1496 | help='If true, serves the web page even after the ' |
| 1497 | 'application quits by a call to exit().') |
| 1498 | |
| 1499 | parser.add_argument('--serve-root', |
| 1500 | help='If set, specifies the root path that the emrun ' |
| 1501 | 'web server serves. If not specified, the directory ' |
| 1502 | 'where the target .html page lives in is served.') |
| 1503 | |
| 1504 | parser.add_argument('--verbose', action='store_true', |
| 1505 | help='Enable verbose logging from emrun internal operation.') |
| 1506 | |
| 1507 | parser.add_argument('--hostname', default=default_webserver_hostname, |
| 1508 | help='Specifies the hostname the server runs in.') |
| 1509 | |
| 1510 | parser.add_argument('--port', default=default_webserver_port, type=int, |
| 1511 | help='Specifies the port the server runs in.') |
| 1512 | |
| 1513 | parser.add_argument('--log-stdout', |
| 1514 | help='Specifies a log filename where the browser process ' |
| 1515 | 'stdout data will be appended to.') |
| 1516 | |
| 1517 | parser.add_argument('--log-stderr', |
| 1518 | help='Specifies a log filename where the browser process stderr data will be appended to.') |
| 1519 | |