()
| 80 | |
| 81 | |
| 82 | def main(): |
| 83 | help_me = False |
| 84 | error_msg = None |
| 85 | invalid_cmd = None |
| 86 | use_edge = False |
| 87 | use_opera = False |
| 88 | use_brave = False |
| 89 | use_comet = False |
| 90 | use_atlas = False |
| 91 | use_chromium = False |
| 92 | use_uc = False |
| 93 | esc_end = False |
| 94 | start_page = None |
| 95 | next_is_url = False |
| 96 | use_colors = True |
| 97 | force_gui = False |
| 98 | rec_behave = False |
| 99 | rec_sb_mgr = False |
| 100 | rec_sb_cdp = False |
| 101 | |
| 102 | sys_executable = sys.executable |
| 103 | if " " in sys_executable: |
| 104 | sys_executable = "python" |
| 105 | |
| 106 | if "linux" in sys.platform: |
| 107 | use_colors = False |
| 108 | c0, c1, c2, c5, c7, cr = set_colors(use_colors) |
| 109 | |
| 110 | command_args = sys.argv[2:] |
| 111 | file_name = command_args[0] |
| 112 | if file_name == "-h" or file_name == "--help": |
| 113 | invalid_run_command("help") |
| 114 | elif not file_name.endswith(".py"): |
| 115 | error_msg = 'File name must end with ".py"!' |
| 116 | elif "*" in file_name or len(str(file_name)) < 4: |
| 117 | error_msg = "Invalid file name!" |
| 118 | elif file_name.startswith("-"): |
| 119 | error_msg = 'File name cannot start with "-"!' |
| 120 | elif "/" in str(file_name) or "\\" in str(file_name): |
| 121 | error_msg = "File must be created in the current directory!" |
| 122 | elif file_name == "abc.py": |
| 123 | error_msg = '"abc.py" is a reserved Python module! Use another name!' |
| 124 | if error_msg: |
| 125 | error_msg = c5 + "ERROR: " + error_msg + cr |
| 126 | invalid_run_command(error_msg) |
| 127 | |
| 128 | dir_name = os.getcwd() |
| 129 | file_path = os.path.join(dir_name, file_name) |
| 130 | |
| 131 | if ( |
| 132 | "--overwrite" in " ".join(command_args).lower() |
| 133 | and os.path.exists(file_path) |
| 134 | ): |
| 135 | os.remove(file_path) |
| 136 | if os.path.exists(file_path): |
| 137 | error_msg = 'File "%s" already exists in this directory!' % file_name |
| 138 | error_msg = c5 + "ERROR: " + error_msg + cr |
| 139 | invalid_run_command(error_msg) |
nothing calls this directly
no test coverage detected
searching dependent graphs…