Skip to content

Commit c2557bd

Browse files
aclark4lifeCopilot
andcommitted
Show group labels in flat-mode dbx list output
Each repo in the flat list now shows its config group(s) in cyan brackets, e.g. '├── ✓ django-mongodb-backend [django]'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1d89679 commit c2557bd

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

src/dbx_python_cli/utils/repo.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,20 +760,35 @@ def list_repos(base_dir, format_style="default", config=None):
760760
if not all_names:
761761
return None
762762

763+
# Build repo → [group, ...] mapping from config (non-global groups only)
764+
repo_to_groups = defaultdict(list)
765+
for gname, gconfig in groups.items():
766+
if gname in global_group_names:
767+
continue
768+
for url in gconfig.get("repos", []):
769+
rname = extract_repo_name_from_url(url)
770+
repo_to_groups[rname].append(gname)
771+
763772
lines = []
764773
for i, repo_name in enumerate(all_names):
765774
is_last = i == len(all_names) - 1
766775
prefix = "└──" if is_last else "├──"
776+
group_list = repo_to_groups.get(repo_name, [])
777+
group_label = (
778+
" " + typer.style(f"[{', '.join(group_list)}]", fg=typer.colors.CYAN)
779+
if group_list
780+
else ""
781+
)
767782
if config:
768783
if repo_name in cloned_names and repo_name in all_available_names:
769784
status = typer.style("✓", fg=typer.colors.GREEN)
770785
elif repo_name in cloned_names:
771786
status = typer.style("?", fg=typer.colors.MAGENTA)
772787
else:
773788
status = typer.style("○", fg=typer.colors.YELLOW)
774-
lines.append(f"{prefix} {status} {repo_name}")
789+
lines.append(f"{prefix} {status} {repo_name}{group_label}")
775790
else:
776-
lines.append(f"{prefix} {repo_name}")
791+
lines.append(f"{prefix} {repo_name}{group_label}")
777792
return "\n".join(lines)
778793

779794
if format_style == "tree":

0 commit comments

Comments
 (0)