This commit is contained in:
Waylon Walker 2025-11-26 13:23:15 -06:00
parent 97bb6f788d
commit 969fbe982d
3 changed files with 61 additions and 1 deletions

View file

@ -0,0 +1,41 @@
# Workspaces
## Usage
``` bash
Usage: workspaces.py [OPTIONS] COMMAND [ARGS]...
Workspace management tool
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --workspaces-name -W TEXT Logical name for this workspace set │
│ (e.g. 'git', 'work', 'personal'). │
│ Overrides WORKSPACES_NAME env. Defaults │
│ to 'git'. │
│ --install-completion Install completion for the current │
│ shell. │
│ --show-completion Show completion for the current shell, │
│ to copy it or customize the │
│ installation. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ list List all workspaces. │
│ create Create a new workspace. │
│ list-repos List repos and branches in the current (or specified) │
│ workspace. │
│ add-repo Add a repo to a workspace. │
│ rm Remove a workspace: │
│ wip For each repo in the workspace: │
│ commit For each repo in the workspace: │
│ push For each repo in the workspace, run 'git push <remote>
<current-branch>'. │
│ status Show detailed status for the current (or specified) workspace. │
│ diff Show git diff for all repos in the workspace. Uses rich Syntax │
│ highlighter for diffs. │
│ attach Attach to a workspace. │
│ tmux tmux commands │
╰──────────────────────────────────────────────────────────────────────────────╯
```

View file

@ -5,3 +5,13 @@ format:
check: check:
uv run ruff check . --fix uv run ruff check . --fix
uv run ty check . uv run ty check .
readme:
echo "# Workspaces" > README.md
echo "" >> README.md
echo "## Usage" >> README.md
echo "" >> README.md
echo '``` bash' >> README.md
COLUMNS=80 ./workspaces.py --help >> README.md
echo '```' >> README.md

View file

@ -1507,7 +1507,7 @@ def tmux_cli_attach(
), ),
): ):
""" """
Attach or create a session for a repo in a workspace. Attach or create a tmux session for a repo in a workspace.
""" """
_settings, _repos_dir, workspaces_dir = get_ctx_paths(ctx) _settings, _repos_dir, workspaces_dir = get_ctx_paths(ctx)
ws_dir = find_workspace_dir(workspaces_dir, workspace) ws_dir = find_workspace_dir(workspaces_dir, workspace)
@ -1536,6 +1536,9 @@ def tmux_cli_list_sessions(
), ),
), ),
): ):
"""
List tmux workspace sessions.
"""
if not_in_tmux(): if not_in_tmux():
console.print("[red]Not in tmux. Exiting.[/red]") console.print("[red]Not in tmux. Exiting.[/red]")
raise typer.Exit(1) raise typer.Exit(1)
@ -1569,6 +1572,9 @@ def tmux_cli_remove(
help="Don't actually remove the session.", help="Don't actually remove the session.",
), ),
): ):
"""
Remove tmux workspace sessions.
"""
if not_in_tmux(): if not_in_tmux():
console.print("[red]Not in tmux. Exiting.[/red]") console.print("[red]Not in tmux. Exiting.[/red]")
raise typer.Exit(1) raise typer.Exit(1)
@ -1612,6 +1618,9 @@ def attach(
), ),
), ),
): ):
"""
Attach to a workspace.
"""
_settings, _repos_dir, workspaces_dir = get_ctx_paths(ctx) _settings, _repos_dir, workspaces_dir = get_ctx_paths(ctx)
if len(list_workspaces(workspaces_dir)) == 0: if len(list_workspaces(workspaces_dir)) == 0:
import sys import sys