pick first if one workspace, log no workspaces

This commit is contained in:
Waylon Walker 2025-11-28 11:10:28 -06:00
parent c0f0a172c7
commit 1d87aa091c

View file

@ -510,6 +510,12 @@ def pick_repo_with_iterfzf(repos: list[Path]) -> Path | None:
return None return None
names = [r.name for r in repos] names = [r.name for r in repos]
if len(names) == 1:
return repos[0]
elif not names:
console.print("[red]No repos found.[/red]")
console.print("Use 'workspaces add' to add repos.")
return None
choice = iterfzf(names, prompt="pick a repo> ") choice = iterfzf(names, prompt="pick a repo> ")
if not choice: if not choice:
@ -1368,6 +1374,10 @@ def clean_workspace(
repos = [directory for directory in ws_dir.iterdir() if directory.is_dir()] repos = [directory for directory in ws_dir.iterdir() if directory.is_dir()]
repo = pick_repo_with_iterfzf(repos) repo = pick_repo_with_iterfzf(repos)
if not repo:
console.print("[red]No repo selected.[/red]")
raise typer.Exit(1)
title, _desc = read_workspace_readme(ws_dir) title, _desc = read_workspace_readme(ws_dir)
console.print( console.print(
f"Cleaning workspace [bold]{title or ws_dir.name}[/bold] (dir: {repo.name})" f"Cleaning workspace [bold]{title or ws_dir.name}[/bold] (dir: {repo.name})"