You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(f"{Fore.GREEN}✓{Fore.RESET} The Token was successfully removed.")
41
42
return"successful"
@@ -48,7 +49,7 @@ def set_token(token):
48
49
49
50
# == 添加 ==
50
51
# --- Token 检查 ---
51
-
ifnottoken.startswith('ghp_'):
52
+
ifnottoken.startswith('ghp_')andnotyes:
52
53
print(f"{Fore.YELLOW}⚠{Fore.RESET} Please check whether the Token is correct.")
53
54
try:
54
55
input(f"Press {Fore.BLUE}Enter{Fore.RESET} to confirm, press {Fore.BLUE}Ctrl + C{Fore.RESET} to cancel...")
@@ -95,35 +96,38 @@ def formatting_url(url):
95
96
print(f"{Fore.RED}✕{Fore.RESET} The repo link is {Fore.YELLOW}invalid{Fore.RESET}, please make sure your repo link is correct.\n{Fore.BLUE}[!]{Fore.RESET} The repo link should like the following:\n{Fore.GREEN}Correct:{Fore.RESET} https://github.com/example/example-repo/\n{Fore.RED}Error:{Fore.RESET} https://github.com/example/example-repo/labels/")
96
97
return"url error"
97
98
98
-
defget_labels(url, save):
99
+
defget_labels(url, save, yes=False):
99
100
# 本函数有以下行为
100
101
# 正常操作保存标签,并返回successful,错误时输出错误原因并返回具体错误信息
101
102
# 可能返回如下错误
102
103
# cancel 操作取消 | get error 获取时出错
103
104
105
+
# v1.8
106
+
# 在调用时如果传入 yes=True则直接确认所有提示
107
+
104
108
# 获取标签
105
109
106
110
ifsave:
107
111
output=save
108
112
else:
113
+
# 无论是否 --yes 都要选择
109
114
print("Please select a save location:", end=" ")
110
-
111
115
output=filedialog.asksaveasfilename(filetypes=[
112
116
("Label data json file", "*.json")
113
117
])
114
118
115
119
ifnotoutput:
116
120
print(f"{Fore.RED}✕{Fore.RESET} No save location is selected.")
117
-
return"cancel"# 返回取消状态
121
+
return"cancel"# 返回取消状态
118
122
119
123
ifnotoutput.endswith(".json"):
120
124
output+=".json"
121
125
122
-
ifos.path.exists(output):
126
+
ifos.path.exists(output)andnotyes:
123
127
print(f"{Fore.YELLOW}⚠{Fore.RESET} The save location is occupied! Whether to overwrite it? [Y/N]")
0 commit comments