()
| 1519 | """ |
| 1520 | |
| 1521 | def main(): |
| 1522 | import getopt |
| 1523 | from platform import system |
| 1524 | from idlelib import testing # bool value |
| 1525 | from idlelib import macosx |
| 1526 | |
| 1527 | global flist, root, use_subprocess |
| 1528 | |
| 1529 | capture_warnings(True) |
| 1530 | use_subprocess = True |
| 1531 | enable_shell = False |
| 1532 | enable_edit = False |
| 1533 | debug = False |
| 1534 | cmd = None |
| 1535 | script = None |
| 1536 | startup = False |
| 1537 | try: |
| 1538 | opts, args = getopt.getopt(sys.argv[1:], "c:deihnr:st:") |
| 1539 | except getopt.error as msg: |
| 1540 | print(f"Error: {msg}\n{usage_msg}", file=sys.stderr) |
| 1541 | sys.exit(2) |
| 1542 | for o, a in opts: |
| 1543 | if o == '-c': |
| 1544 | cmd = a |
| 1545 | enable_shell = True |
| 1546 | if o == '-d': |
| 1547 | debug = True |
| 1548 | enable_shell = True |
| 1549 | if o == '-e': |
| 1550 | enable_edit = True |
| 1551 | if o == '-h': |
| 1552 | sys.stdout.write(usage_msg) |
| 1553 | sys.exit() |
| 1554 | if o == '-i': |
| 1555 | enable_shell = True |
| 1556 | if o == '-n': |
| 1557 | print(" Warning: running IDLE without a subprocess is deprecated.", |
| 1558 | file=sys.stderr) |
| 1559 | use_subprocess = False |
| 1560 | if o == '-r': |
| 1561 | script = a |
| 1562 | if os.path.isfile(script): |
| 1563 | pass |
| 1564 | else: |
| 1565 | print("No script file: ", script) |
| 1566 | sys.exit() |
| 1567 | enable_shell = True |
| 1568 | if o == '-s': |
| 1569 | startup = True |
| 1570 | enable_shell = True |
| 1571 | if o == '-t': |
| 1572 | PyShell.shell_title = a |
| 1573 | enable_shell = True |
| 1574 | if args and args[0] == '-': |
| 1575 | cmd = sys.stdin.read() |
| 1576 | enable_shell = True |
| 1577 | # process sys.argv and sys.path: |
| 1578 | for i in range(len(sys.path)): |
no test coverage detected