From b5396536c0bf98e3f5c5315b630274372ca8a6ce 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?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Mon, 28 Sep 2026 03:58:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(func/config):=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E6=94=B9=E4=B8=BA=20null=20=E8=80=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更“语义化” --- src/function/maintain/config.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/function/maintain/config.py b/src/function/maintain/config.py index dc3f1ea..906cc31 100644 --- a/src/function/maintain/config.py +++ b/src/function/maintain/config.py @@ -27,17 +27,21 @@ ] class 配置信息: + """ + 存放有关 Sundry 配置文件(config.json)的信息。 + """ + 默认配置: dict[str, Any] = { "$schema": "https://duckduckstudio.github.io/yazicbs.github.io/Tools/Sundry/config/schema/1.4.json", "version": "1.4", "debug": False, "paths": { - "winget-pkgs": "", - "winget-tools": "" + "winget-pkgs": None, + "winget-tools": None }, "repos": { - "winget-pkgs": "", - "winget-tools": "" + "winget-pkgs": None, + "winget-tools": None }, "git": { "retry_interval": 50, @@ -240,7 +244,7 @@ def 读取配置项(配置项: 所有配置项 | str, 静默: bool = False) -> s return 当前字典[最后键] else: if not 静默: - print(f"{MSHead.Error} 读取配置文件失败:\n{Fore.RED}值 \"{配置项}\" 为空{Fore.RESET}") + print(f"{MSHead.Error} 读取配置文件失败:\n{Fore.RED}\"{配置项}\" 的值为空 (null){Fore.RESET}") print(f"{MSHead.Message} 运行 sundry config {配置项} <值> 来修改配置文件中的值") return None except KeyError as e: