lista solo repos remotos y descripción en una línea
This commit is contained in:
+2
-19
@@ -208,7 +208,6 @@ def normalize_url(url: str) -> str:
|
|||||||
|
|
||||||
def build_entries(remote_repos: list[RemoteRepo], local_index: dict[str, Path]) -> list[RepoEntry]:
|
def build_entries(remote_repos: list[RemoteRepo], local_index: dict[str, Path]) -> list[RepoEntry]:
|
||||||
entries: list[RepoEntry] = []
|
entries: list[RepoEntry] = []
|
||||||
matched_paths: set[Path] = set()
|
|
||||||
for r in remote_repos:
|
for r in remote_repos:
|
||||||
local: Path | None = None
|
local: Path | None = None
|
||||||
for candidate_url in (r.clone_url, r.ssh_url):
|
for candidate_url in (r.clone_url, r.ssh_url):
|
||||||
@@ -218,8 +217,6 @@ def build_entries(remote_repos: list[RemoteRepo], local_index: dict[str, Path])
|
|||||||
break
|
break
|
||||||
if local is None and f"name::{r.name}" in local_index:
|
if local is None and f"name::{r.name}" in local_index:
|
||||||
local = local_index[f"name::{r.name}"]
|
local = local_index[f"name::{r.name}"]
|
||||||
if local is not None:
|
|
||||||
matched_paths.add(local)
|
|
||||||
entries.append(
|
entries.append(
|
||||||
RepoEntry(
|
RepoEntry(
|
||||||
name=r.name,
|
name=r.name,
|
||||||
@@ -228,21 +225,7 @@ def build_entries(remote_repos: list[RemoteRepo], local_index: dict[str, Path])
|
|||||||
local_path=local,
|
local_path=local,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# Añadir repos locales que NO están en el servidor (por info)
|
entries.sort(key=lambda e: (e.local_path is not None, e.name.lower()))
|
||||||
for key, path in local_index.items():
|
|
||||||
if key.startswith("name::"):
|
|
||||||
continue
|
|
||||||
if path in matched_paths:
|
|
||||||
continue
|
|
||||||
entries.append(
|
|
||||||
RepoEntry(
|
|
||||||
name=path.name,
|
|
||||||
full_name=path.name,
|
|
||||||
remote=None,
|
|
||||||
local_path=path,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
entries.sort(key=lambda e: (e.local_path is None, e.name.lower()))
|
|
||||||
return entries
|
return entries
|
||||||
|
|
||||||
|
|
||||||
@@ -259,7 +242,7 @@ def render(entries: list[RepoEntry], cursor: int, base: Path, owner: str, status
|
|||||||
table.add_column(" ", width=1, no_wrap=True)
|
table.add_column(" ", width=1, no_wrap=True)
|
||||||
table.add_column("Estado", width=14, no_wrap=True)
|
table.add_column("Estado", width=14, no_wrap=True)
|
||||||
table.add_column("Repo", style="bold", no_wrap=True, overflow="ellipsis")
|
table.add_column("Repo", style="bold", no_wrap=True, overflow="ellipsis")
|
||||||
table.add_column("Descripción", overflow="ellipsis", ratio=1)
|
table.add_column("Descripción", no_wrap=True, overflow="ellipsis", ratio=1)
|
||||||
|
|
||||||
for i, e in enumerate(entries):
|
for i, e in enumerate(entries):
|
||||||
# Cursor
|
# Cursor
|
||||||
|
|||||||
Reference in New Issue
Block a user