From 4ba7ea9c00ba30ae6d957886ae0bf7b2d74c0ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= Date: Tue, 10 Sep 2024 22:42:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=98=BE=E7=A4=BA=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=20(#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + other-languages/en_US/glm-en_US.py | 8 +++++--- "\347\250\213\345\272\217\350\204\232\346\234\254/glm.py" | 8 +++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 3d75f7b..24411f8 100644 --- a/.gitignore +++ b/.gitignore @@ -162,6 +162,7 @@ cython_debug/ #.idea/ # 开发清单 +软著/ # Debug labels.json diff --git a/other-languages/en_US/glm-en_US.py b/other-languages/en_US/glm-en_US.py index 1335d32..dc0ac10 100644 --- a/other-languages/en_US/glm-en_US.py +++ b/other-languages/en_US/glm-en_US.py @@ -115,8 +115,10 @@ def get_labels(url, save): output += ".json" if os.path.exists(output): - print(f"{Fore.RED}✕{Fore.RESET} The save location is being occupied!") - return "cancel"# 返回取消状态 + print(f"{Fore.YELLOW}⚠{Fore.RESET} The save location is occupied! Whether to overwrite it? [Y/N]") + if input(f"{Fore.BLUE}?{Fore.RESET} [Y] Confirm [N] Cancel: ").lower() not in ["是", "覆盖", "overwrite", "y", "yes"]: + print(f"{Fore.BLUE}[!]{Fore.RESET} Cancelled operation.") + return "cancel"# 返回取消状态 print(f"\r{Fore.GREEN}✓{Fore.RESET} The save location has been selected: {Fore.BLUE}{output}{Fore.RESET}") # ------------ @@ -382,7 +384,7 @@ def main(): except Exception as e: print(f"{Fore.RED}✕{Fore.RESET} Unable to open the configuration file: {Fore.RED}{e}{Fore.RESET}\n{Fore.BLUE}[!]{Fore.RESET} Please confirm that the configuration file path is correct: {Fore.BLUE}{config_path}{Fore.RESET}") elif args.version: - print(f"{Fore.GREEN}✓{Fore.RESET} The current version is:\nGitHub Labels Manager v{Fore.BLUE}{version}{Fore.RESET}") + print(f"{Fore.GREEN}✓{Fore.RESET} The current version is:\nGitHub Labels Manager v{Fore.BLUE}{version}{Fore.RESET}\nInstalled in: {Fore.BLUE}{script_path}{Fore.RESET}") else: print(f"{Fore.RED}✕{Fore.RESET} Missing configuration item.") return 1, running_result diff --git "a/\347\250\213\345\272\217\350\204\232\346\234\254/glm.py" "b/\347\250\213\345\272\217\350\204\232\346\234\254/glm.py" index 525cb34..38f1f08 100644 --- "a/\347\250\213\345\272\217\350\204\232\346\234\254/glm.py" +++ "b/\347\250\213\345\272\217\350\204\232\346\234\254/glm.py" @@ -115,8 +115,10 @@ def get_labels(url, save): output += ".json" if os.path.exists(output): - print(f"{Fore.RED}✕{Fore.RESET} 保存位置已被占用!") - return "cancel"# 返回取消状态 + print(f"{Fore.YELLOW}⚠{Fore.RESET} 保存位置已被占用!是否覆盖 [Y/N]") + if input(f"{Fore.BLUE}?{Fore.RESET} [Y] 覆盖 [N] 取消: ").lower() not in ["是", "覆盖", "y", "yes"]: + print(f"{Fore.BLUE}[!]{Fore.RESET} 已取消操作") + return "cancel"# 返回取消状态 print(f"\r{Fore.GREEN}✓{Fore.RESET} 已选择保存位置: {Fore.BLUE}{output}{Fore.RESET}") # ------------ @@ -382,7 +384,7 @@ def main(): except Exception as e: print(f"{Fore.RED}✕{Fore.RESET} 无法打开配置文件: {Fore.RED}{e}{Fore.RESET}\n{Fore.BLUE}[!]{Fore.RESET} 请确认配置文件路径正确: {Fore.BLUE}{config_path}{Fore.RESET}") elif args.version: - print(f"{Fore.GREEN}✓{Fore.RESET} 当前使用的版本为:\nGitHub Labels Manager v{Fore.BLUE}{version}{Fore.RESET}") + print(f"{Fore.GREEN}✓{Fore.RESET} 当前使用的版本为:\nGitHub Labels Manager v{Fore.BLUE}{version}{Fore.RESET}\n安装在: {Fore.BLUE}{script_path}{Fore.RESET}") else: print(f"{Fore.RED}✕{Fore.RESET} 缺少配置项") return 1, running_result