Skip to content

Commit 4ba7ea9

Browse files
feat: 显示安装目录 (#13)
1 parent 5fe8df4 commit 4ba7ea9

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ cython_debug/
162162
#.idea/
163163

164164
# 开发清单
165+
软著/
165166

166167
# Debug
167168
labels.json

other-languages/en_US/glm-en_US.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ def get_labels(url, save):
115115
output += ".json"
116116

117117
if os.path.exists(output):
118-
print(f"{Fore.RED}{Fore.RESET} The save location is being occupied!")
119-
return "cancel"# 返回取消状态
118+
print(f"{Fore.YELLOW}{Fore.RESET} The save location is occupied! Whether to overwrite it? [Y/N]")
119+
if input(f"{Fore.BLUE}?{Fore.RESET} [Y] Confirm [N] Cancel: ").lower() not in ["是", "覆盖", "overwrite", "y", "yes"]:
120+
print(f"{Fore.BLUE}[!]{Fore.RESET} Cancelled operation.")
121+
return "cancel"# 返回取消状态
120122

121123
print(f"\r{Fore.GREEN}{Fore.RESET} The save location has been selected: {Fore.BLUE}{output}{Fore.RESET}")
122124
# ------------
@@ -382,7 +384,7 @@ def main():
382384
except Exception as e:
383385
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}")
384386
elif args.version:
385-
print(f"{Fore.GREEN}{Fore.RESET} The current version is:\nGitHub Labels Manager v{Fore.BLUE}{version}{Fore.RESET}")
387+
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}")
386388
else:
387389
print(f"{Fore.RED}{Fore.RESET} Missing configuration item.")
388390
return 1, running_result

程序脚本/glm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ def get_labels(url, save):
115115
output += ".json"
116116

117117
if os.path.exists(output):
118-
print(f"{Fore.RED}{Fore.RESET} 保存位置已被占用!")
119-
return "cancel"# 返回取消状态
118+
print(f"{Fore.YELLOW}{Fore.RESET} 保存位置已被占用!是否覆盖 [Y/N]")
119+
if input(f"{Fore.BLUE}?{Fore.RESET} [Y] 覆盖 [N] 取消: ").lower() not in ["是", "覆盖", "y", "yes"]:
120+
print(f"{Fore.BLUE}[!]{Fore.RESET} 已取消操作")
121+
return "cancel"# 返回取消状态
120122

121123
print(f"\r{Fore.GREEN}{Fore.RESET} 已选择保存位置: {Fore.BLUE}{output}{Fore.RESET}")
122124
# ------------
@@ -382,7 +384,7 @@ def main():
382384
except Exception as e:
383385
print(f"{Fore.RED}{Fore.RESET} 无法打开配置文件: {Fore.RED}{e}{Fore.RESET}\n{Fore.BLUE}[!]{Fore.RESET} 请确认配置文件路径正确: {Fore.BLUE}{config_path}{Fore.RESET}")
384386
elif args.version:
385-
print(f"{Fore.GREEN}{Fore.RESET} 当前使用的版本为:\nGitHub Labels Manager v{Fore.BLUE}{version}{Fore.RESET}")
387+
print(f"{Fore.GREEN}{Fore.RESET} 当前使用的版本为:\nGitHub Labels Manager v{Fore.BLUE}{version}{Fore.RESET}\n安装在: {Fore.BLUE}{script_path}{Fore.RESET}")
386388
else:
387389
print(f"{Fore.RED}{Fore.RESET} 缺少配置项")
388390
return 1, running_result

0 commit comments

Comments
 (0)