This commit is contained in:
bluepulsar
2025-12-31 19:37:33 +08:00
parent fc0025650f
commit fbffe0088f
6 changed files with 44 additions and 29 deletions
+11
View File
@@ -56,6 +56,17 @@ def load_config(config_name_or_path):
with open(package_config_path, 'r', encoding='utf-8') as f:
return json.load(f)
def list_configs():
"""
List all available JSON configuration files in the configs directory.
Returns:
List of configuration names (without .json extension), sorted alphabetically.
Returns an empty list if no JSON files are found.
"""
config_files = sorted(CONFIG_DIR.glob("*.json"))
return [f.stem for f in config_files]
def _format_json_value(value, indent_level=0, indent_str=" "):
"""
Recursively format JSON value with arrays/lists on single line.