From 9ed5c639f0dd39b2d30cabc52c3599c1609bfd93 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 20 Jan 2026 08:08:22 +0000 Subject: [PATCH] Add -r shortcut for --rebase option in wt sync command Added -r as a shortcut for the existing --rebase flag in the sync command. This provides a more convenient way for users to request rebasing during sync. Also added a test to verify the shortcut works correctly. --- tools/wt-worktree/tests/test_cli.py | 7 +++++++ tools/wt-worktree/wt/cli.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/wt-worktree/tests/test_cli.py b/tools/wt-worktree/tests/test_cli.py index c50453b..0ec6da8 100644 --- a/tools/wt-worktree/tests/test_cli.py +++ b/tools/wt-worktree/tests/test_cli.py @@ -296,6 +296,13 @@ def test_sync_command_with_rebase(runner, initialized_repo, no_prompt): assert result.exit_code == 0 or result.exit_code == 3 +def test_sync_command_with_rebase_shortcut(runner, initialized_repo, no_prompt): + """Test wt sync -r command (shortcut for --rebase).""" + # Run sync with -r shortcut - will have no upstream but shouldn't crash + result = runner.invoke(cli, ["sync", "-r"]) + assert result.exit_code == 0 or result.exit_code == 3 + + def test_sync_command_invalid_args(runner, initialized_repo): """Test wt sync with invalid argument combinations.""" # Both include and exclude diff --git a/tools/wt-worktree/wt/cli.py b/tools/wt-worktree/wt/cli.py index 9f99312..2d721f3 100644 --- a/tools/wt-worktree/wt/cli.py +++ b/tools/wt-worktree/wt/cli.py @@ -491,7 +491,7 @@ def config(ctx: Context, key: Optional[str], value: Optional[str], @click.option("--all", "sync_all", is_flag=True, help="Sync all worktrees") @click.option("--include", help="Comma-separated list of worktrees to sync") @click.option("--exclude", help="Comma-separated list of worktrees to skip") -@click.option("--rebase", is_flag=True, help="Rebase onto default base after pull") +@click.option("-r", "--rebase", is_flag=True, help="Rebase onto default base after pull") @pass_context def sync(ctx: Context, sync_all: bool, include: Optional[str], exclude: Optional[str], rebase: bool):