(msg: str, must_exist: bool = True)
| 242 | )) |
| 243 | |
| 244 | def _ask_file(msg: str, must_exist: bool = True) -> str: |
| 245 | while True: |
| 246 | path = questionary.path(msg, only_directories=False).ask() |
| 247 | if path is None: |
| 248 | raise KeyboardInterrupt |
| 249 | path = path.strip() |
| 250 | if must_exist and not os.path.isfile(path): |
| 251 | console.print(f"[red]文件不存在:{path}[/red]") |
| 252 | else: |
| 253 | return path |
| 254 | |
| 255 | def _ask_dir(msg: str) -> str: |
| 256 | path = questionary.path(msg, only_directories=True).ask() |