fix(env): 🐛 Improve handling of directory paths in info command

* Enhanced the `info` command to support both single `Path` objects and lists of `Path` objects.
* For lists, each path is now displayed on a separate line, improving readability.
* Maintained original logic for single `Path` objects to ensure consistent behavior.
This commit is contained in:
Andy
2025-07-25 18:46:55 +00:00
parent f69eb691d7
commit 1b9fbe3401

View File

@@ -98,12 +98,21 @@ def info() -> None:
for name in sorted(dir(config.directories)):
if name.startswith("__") or name == "app_dirs":
continue
path = getattr(config.directories, name).resolve()
for var, var_path in path_vars.items():
if path.is_relative_to(var_path):
path = rf"%{var}%\{path.relative_to(var_path)}"
break
table.add_row(name.title(), str(path))
attr_value = getattr(config.directories, name)
# Handle both single Path objects and lists of Path objects
if isinstance(attr_value, list):
# For lists, show each path on a separate line
paths_str = "\n".join(str(path.resolve()) for path in attr_value)
table.add_row(name.title(), paths_str)
else:
# For single Path objects, use the original logic
path = attr_value.resolve()
for var, var_path in path_vars.items():
if path.is_relative_to(var_path):
path = rf"%{var}%\{path.relative_to(var_path)}"
break
table.add_row(name.title(), str(path))
console.print(Padding(table, (1, 5)))