From 1b9fbe340174691dd08e2235c4725a958fbe647b Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 25 Jul 2025 18:46:55 +0000 Subject: [PATCH] =?UTF-8?q?fix(env):=20=F0=9F=90=9B=20Improve=20handling?= =?UTF-8?q?=20of=20directory=20paths=20in=20`info`=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- unshackle/commands/env.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/unshackle/commands/env.py b/unshackle/commands/env.py index 88e56a8..1a265e5 100644 --- a/unshackle/commands/env.py +++ b/unshackle/commands/env.py @@ -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)))