diff --git a/cfbs/cfbs_config.py b/cfbs/cfbs_config.py index b4a63ab..997146c 100644 --- a/cfbs/cfbs_config.py +++ b/cfbs/cfbs_config.py @@ -81,7 +81,11 @@ def save(self): f.write(data) def longest_module_key_length(self, key) -> int: - return max((len(m.get(key, "")) for m in self["build"])) if self.get("build") else 0 + return ( + max((len(m.get(key, "")) for m in self["build"])) + if self.get("build") + else 0 + ) def add_with_dependencies(self, module, remote_config=None, dependent=None): if type(module) is list: diff --git a/cfbs/commands.py b/cfbs/commands.py index 4119b1a..102ce10 100644 --- a/cfbs/commands.py +++ b/cfbs/commands.py @@ -302,18 +302,28 @@ def status_command() -> int: if not modules: return 0 print("\nModules:") - max_length = config.longest_module_key_length("name") + max_name_length = config.longest_module_key_length("name") + max_version_length = config.longest_module_key_length("version") counter = 1 for m in modules: if m["name"].startswith("./"): status = "Copied" - commit = pad_right("local", 40) + version = "local" + commit = pad_right("", 40) else: path = get_download_path(m) status = "Downloaded" if os.path.exists(path) else "Not downloaded" + version = m.get("version", "") commit = m["commit"] - name = pad_right(m["name"], max_length) - print("%03d %s @ %s (%s)" % (counter, name, commit, status)) + name = pad_right(m["name"], max_name_length) + version = pad_right(version, max_version_length) + version_with_commit = version + " " + if m["name"].startswith("./"): + version_with_commit += " " + else: + version_with_commit += "/" + version_with_commit += " " + commit + print("%03d %s @ %s (%s)" % (counter, name, version_with_commit, status)) counter += 1 return 0