Fix list subcommand to work from any working directory.

This commit is contained in:
2026-11-17 13:43:54 -06:00
parent 82433b9c63
commit 06b82c9398

View File

@@ -119,30 +119,35 @@ def convert(args):
def list_configs():
excluded_files = ["schema.yaml"]
excluded_dirs = ["__pycache__"]
cprint("Available import/export formats:", "cyan", attrs=["bold"])
printed_dirs = []
for folder in AuDaGe.folders:
cprint(" Folder '" + folder.name + "':", "green", attrs=["bold"])
for dirpath, _, files in folder.walk(on_error=print):
dir_path = Path(dirpath)
dir_path = Path(dirpath).relative_to(folder)
if (
len(dir_path.parts) >= 2
and dir_path.parts[1] not in printed_dirs
len(dir_path.parts) >= 1
and dir_path.parts[0] not in excluded_dirs + printed_dirs
):
printed_dirs.append(dir_path.parts[1])
printed_dirs.append(dir_path.parts[0])
cprint(
" " + dir_path.parts[1].replace("_", " ").title() + ":",
" " + dir_path.parts[0].replace("_", " ").title() + ":",
attrs=["bold"],
)
for file in files:
file_path = Path(file)
if file_path.suffix == ".yaml":
if (
file_path.suffix == ".yaml"
and file not in excluded_files
):
print(
" "
+ str(
Path(*Path(dirpath).parts[1:]).joinpath(
file_path.stem
)
Path(
*Path(dirpath).relative_to(folder).parts[1:]
).joinpath(file_path.stem)
).replace("\\", ".")
)