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):