diff --git a/workspaces.py b/workspaces.py index e3a53d2..db58cad 100755 --- a/workspaces.py +++ b/workspaces.py @@ -510,6 +510,12 @@ def pick_repo_with_iterfzf(repos: list[Path]) -> Path | None: return None 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> ") if not choice: @@ -1368,6 +1374,10 @@ def clean_workspace( repos = [directory for directory in ws_dir.iterdir() if directory.is_dir()] 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) console.print( f"Cleaning workspace [bold]{title or ws_dir.name}[/bold] (dir: {repo.name})"