Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Remove redundant --help-page snapshot tests (#579)
Maximilian Roos3fee985684ad
diff --git a/tests/integration_tests/help.rs b/tests/integration_tests/help.rsindex 241dda0b5..315ed871d 100644--- a/tests/integration_tests/help.rs+++ b/tests/integration_tests/help.rs@@ -118,50 +118,6 @@ fn test_help_md_subcommand() {});}-#[test]-fn test_help_page_merge() {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");- settings.bind(|| {- let mut cmd = wt_command();- cmd.args(["merge", "--help-page"]);- assert_cmd_snapshot!("help_page_merge", cmd);- });-}--#[test]-fn test_help_page_switch() {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");- settings.bind(|| {- let mut cmd = wt_command();- cmd.args(["switch", "--help-page"]);- assert_cmd_snapshot!("help_page_switch", cmd);- });-}--#[test]-fn test_help_page_no_subcommand() {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");- settings.bind(|| {- let mut cmd = wt_command();- cmd.arg("--help-page");- assert_cmd_snapshot!("help_page_no_subcommand", cmd);- });-}--#[test]-fn test_help_page_unknown_command() {- let mut settings = Settings::clone_current();- settings.set_snapshot_path("../snapshots");- settings.bind(|| {- let mut cmd = wt_command();- cmd.args(["nonexistent", "--help-page"]);- assert_cmd_snapshot!("help_page_unknown", cmd);- });-}-/// Verifies that markdown tables remain intact (no mid-row breaks) even when/// table width exceeds terminal width. Tables should extend past 80 columns/// rather than wrap incorrectly.diff --git a/tests/snapshots/integration__integration_tests__help__help_page_merge.snap b/tests/snapshots/integration__integration_tests__help__help_page_merge.snapdeleted file mode 100644index be0598a8c..000000000--- a/tests/snapshots/integration__integration_tests__help__help_page_merge.snap+++ /dev/null@@ -1,157 +0,0 @@-----source: tests/integration_tests/help.rs-info:- program: wt- args:- - merge- - "--help-page"- env:- CLICOLOR_FORCE: "1"- COLUMNS: "500"- GIT_EDITOR: ""- RUST_LOG: warn- SOURCE_DATE_EPOCH: "1735776000"- TERM: alacritty- WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"-----success: true-exit_code: 0------ stdout ------<!-- ⚠️ AUTO-GENERATED from `wt merge --help-page` — edit cli.rs to update -->--Merge the current branch into the target branch, defaulting to the main branch. Unlike `git merge`, this merges the current branch into a target (rather than a target into the current branch). Similar to clicking "Merge pull request" on GitHub.--<figure class="demo">-<picture>- <source srcset="/assets/docs/dark/wt-merge.gif" media="(prefers-color-scheme: dark)">- <img src="/assets/docs/light/wt-merge.gif" alt="wt merge demo" width="1600" height="900">-</picture>-</figure>--## Examples--Merge to the default branch:--```bash-wt merge-```--Merge to a different branch:--```bash-wt merge develop-```--Keep the worktree after merging:--```bash-wt merge --no-remove-```--Preserve commit history (no squash):--```bash-wt merge --no-squash-```--Skip committing/squashing (rebase still runs unless --no-rebase):--```bash-wt merge --no-commit-```--## Pipeline--`wt merge` runs these steps:--1. **Squash** — Stages uncommitted changes, then combines all commits since target into one (like GitHub's "Squash and merge"). Use `--stage` to control what gets staged: `all` (default), `tracked`, or `none`. A backup ref is saved to `refs/wt-backup/<branch>`. With `--no-squash`, uncommitted changes become a separate commit and individual commits are preserved.-2. **Rebase** — Rebases onto target if behind. Skipped if already up-to-date. Conflicts abort immediately.-3. **Pre-merge hooks** — Hooks run after rebase, before merge. Failures abort. See [`wt hook`](@/hook.md).-4. **Merge** — Fast-forward merge to the target branch. Non-fast-forward merges are rejected.-5. **Pre-remove hooks** — Hooks run before removing worktree. Failures abort.-6. **Cleanup** — Removes the worktree and branch. Use `--no-remove` to keep the worktree. When already on the target branch or in the main worktree, the worktree is preserved.-7. **Post-merge hooks** — Hooks run after cleanup. Failures are logged but don't abort.--Use `--no-commit` to skip committing uncommitted changes and squashing; rebase still runs by default and can rewrite commits unless `--no-rebase` is passed. Useful after preparing commits manually with `wt step`. Requires a clean working tree.--## Local CI--For personal projects, pre-merge hooks open up the possibility of a workflow with much faster iteration — an order of magnitude more small changes instead of fewer large ones.--Historically, ensuring tests ran before merging was difficult to enforce locally. Remote CI was valuable for the process as much as the checks: it guaranteed validation happened. `wt merge` brings that guarantee local.--The full workflow: start an agent (one of many) on a task, work elsewhere, return when it's ready. Review the diff, run `wt merge`, move on. Pre-merge hooks validate before merging — if they pass, the branch goes to the default branch and the worktree cleans up.--```toml-[pre-merge]-test = "cargo test"-lint = "cargo clippy"-```--## See also--- [`wt step`](@/step.md) — Run individual operations (commit, squash, rebase, push)-- [`wt remove`](@/remove.md) — Remove worktrees without merging-- [`wt switch`](@/switch.md) — Navigate to other worktrees--## Command reference--```-wt merge - Merge worktree into target branch[0m-[0m-Squash & rebase, fast-forward target, remove the worktree.[0m--Usage: [1m[36mwt merge[0m [36m[OPTIONS][0m [36m[TARGET][0m--[1m[32mArguments:[0m- [36m[TARGET][0m- Target branch[0m- [0m- Defaults to default branch.[0m--[1m[32mOptions:[0m- [1m[36m--no-squash[0m- Skip commit squashing-- [1m[36m--no-commit[0m- Skip commit and squash-- [1m[36m--no-rebase[0m- Skip rebase (fail if not already rebased)-- [1m[36m--no-remove[0m- Keep worktree after merge-- [1m[36m--no-verify[0m- Skip hooks-- [1m[36m-y[0m, [1m[36m--yes[0m- Skip approval prompts-- [1m[36m--stage[0m[36m [0m[36m<STAGE>[0m- What to stage before committing [default: all]-- Possible values:- - [1m[36mall[0m: Stage everything: untracked files + unstaged tracked- changes- - [1m[36mtracked[0m: Stage tracked changes only (like [1mgit add -u[0m)- - [1m[36mnone[0m: Stage nothing, commit only what's already in the index-- [1m[36m-h[0m, [1m[36m--help[0m- Print help (see a summary with '-h')--[1m[32mGlobal Options:[0m- [1m[36m-C[0m[36m [0m[36m<path>[0m- Working directory for this command-- [1m[36m--config[0m[36m [0m[36m<path>[0m- User config file path-- [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m- Show debug info (-v), or also write diagnostic report (-vv)-```--<!-- END AUTO-GENERATED from `wt merge --help-page` -->------- stderr -----diff --git a/tests/snapshots/integration__integration_tests__help__help_page_no_subcommand.snap b/tests/snapshots/integration__integration_tests__help__help_page_no_subcommand.snapdeleted file mode 100644index d0af7a6e5..000000000--- a/tests/snapshots/integration__integration_tests__help__help_page_no_subcommand.snap+++ /dev/null@@ -1,22 +0,0 @@-----source: tests/integration_tests/help.rs-info:- program: wt- args:- - "--help-page"- env:- CLICOLOR_FORCE: "1"- COLUMNS: "150"- GIT_EDITOR: ""- RUST_LOG: warn- SOURCE_DATE_EPOCH: "1735776000"- WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"-----success: true-exit_code: 0------ stdout ------------ stderr ------Usage: wt <command> --help-page-Commands with pages: merge, switch, remove, listdiff --git a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap b/tests/snapshots/integration__integration_tests__help__help_page_switch.snapdeleted file mode 100644index 4df27cbf7..000000000--- a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap+++ /dev/null@@ -1,163 +0,0 @@-----source: tests/integration_tests/help.rs-info:- program: wt- args:- - switch- - "--help-page"- env:- CLICOLOR_FORCE: "1"- COLUMNS: "500"- GIT_EDITOR: ""- RUST_LOG: warn- SOURCE_DATE_EPOCH: "1735776000"- TERM: alacritty- WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"-----success: true-exit_code: 0------ stdout ------<!-- ⚠️ AUTO-GENERATED from `wt switch --help-page` — edit cli.rs to update -->--Change directory to a worktree, creating one if needed.--<figure class="demo">-<picture>- <source srcset="/assets/docs/dark/wt-switch.gif" media="(prefers-color-scheme: dark)">- <img src="/assets/docs/light/wt-switch.gif" alt="wt switch demo" width="1600" height="900">-</picture>-</figure>--Worktrees are addressed by branch name; paths are computed from a configurable template. Unlike `git switch`, this navigates between worktrees rather than changing branches in place.--## Examples--```bash-wt switch feature-auth # Switch to worktree-wt switch - # Previous worktree (like cd -)-wt switch --create new-feature # Create new branch and worktree-wt switch --create hotfix --base production-```--## Creating a branch--The `--create` flag creates a new branch from the `--base` branch (defaults to default branch). Without `--create`, the branch must already exist.--## Creating worktrees--If the branch already has a worktree, `wt switch` changes directories to it. Otherwise, it creates one, running [hooks](@/hook.md).--When creating a worktree, worktrunk:--1. Creates worktree at configured path-2. Switches to new directory-3. Runs [post-create hooks](@/hook.md#post-create) (blocking)-4. Spawns [post-start hooks](@/hook.md#post-start) (background)--```bash-wt switch feature # Existing branch → creates worktree-wt switch --create feature # New branch and worktree-wt switch --create fix --base release # New branch from release-wt switch --create temp --no-verify # Skip hooks-```--## Shortcuts--| Shortcut | Meaning |-|----------|---------|-| `^` | Default branch (`main`/`master`) |-| `@` | Current branch/worktree |-| `-` | Previous worktree (like `cd -`) |--```bash-wt switch - # Back to previous-wt switch ^ # Default branch worktree-wt switch --create fix --base=@ # Branch from current HEAD-```--## When wt switch fails--- **Branch doesn't exist** — Use `--create`, or check `wt list --branches`-- **Path occupied** — Another worktree is at the target path; switch to it or remove it-- **Stale directory** — Use `--clobber` to remove a non-worktree directory at the target path--To change which branch a worktree is on, use `git switch` inside that worktree.--## See also--- [`wt select`](@/select.md) — Interactive worktree selection-- [`wt list`](@/list.md) — View all worktrees-- [`wt remove`](@/remove.md) — Delete worktrees when done-- [`wt merge`](@/merge.md) — Integrate changes back to the default branch--## Command reference--```-wt switch - Switch to a worktree--Usage: [1m[36mwt switch[0m [36m[OPTIONS][0m [36m<BRANCH>[0m [1m[36m[--[0m [36m<EXECUTE_ARGS>...[0m[1m[36m][0m--[1m[32mArguments:[0m- [36m<BRANCH>[0m- Branch name[0m- [0m- Shortcuts: '^' (default branch), '-' (previous), '@' (current)[0m-- [36m[EXECUTE_ARGS]...[0m- Additional arguments for --execute command (after --)[0m- [0m- Arguments after [1m--[0m are appended to the execute command. Each argument- is POSIX shell-escaped before appending.[0m--[1m[32mOptions:[0m- [1m[36m-c[0m, [1m[36m--create[0m- Create a new branch-- [1m[36m-b[0m, [1m[36m--base[0m[36m [0m[36m<BASE>[0m- Base branch[0m- [0m- Defaults to default branch.[0m-- [1m[36m-x[0m, [1m[36m--execute[0m[36m [0m[36m<EXECUTE>[0m- Command to run after switch[0m- [0m- Replaces the wt process with the command after switching, giving it- full terminal control. Useful for launching editors, AI agents, or- other interactive tools.[0m- [0m- Especially useful with shell aliases:[0m- [0m- [1m[1malias wsc='wt switch --create -x claude'[0m- [1mwsc feature-branch -- 'Fix GH #322'[0m- [0m[0m- Then [1mwsc feature-branch[0m creates the worktree and launches Claude Code.- Arguments after [1m--[0m are passed to the command, so [1mwsc feature -- 'Fix- GH #322'[0m runs [1mclaude 'Fix GH #322'[0m, starting Claude with a prompt.[0m-- [1m[36m-y[0m, [1m[36m--yes[0m- Skip approval prompts-- [1m[36m--clobber[0m- Remove stale paths at target-- [1m[36m--no-verify[0m- Skip hooks-- [1m[36m-h[0m, [1m[36m--help[0m- Print help (see a summary with '-h')--[1m[32mGlobal Options:[0m- [1m[36m-C[0m[36m [0m[36m<path>[0m- Working directory for this command-- [1m[36m--config[0m[36m [0m[36m<path>[0m- User config file path-- [1m[36m-v[0m, [1m[36m--verbose[0m[36m...[0m- Show debug info (-v), or also write diagnostic report (-vv)-```--<!-- END AUTO-GENERATED from `wt switch --help-page` -->------- stderr -----diff --git a/tests/snapshots/integration__integration_tests__help__help_page_unknown.snap b/tests/snapshots/integration__integration_tests__help__help_page_unknown.snapdeleted file mode 100644index 139627240..000000000--- a/tests/snapshots/integration__integration_tests__help__help_page_unknown.snap+++ /dev/null@@ -1,22 +0,0 @@-----source: tests/integration_tests/help.rs-info:- program: wt- args:- - nonexistent- - "--help-page"- env:- CLICOLOR_FORCE: "1"- COLUMNS: "150"- GIT_EDITOR: ""- RUST_LOG: warn- SOURCE_DATE_EPOCH: "1735776000"- WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"-----success: true-exit_code: 0------ stdout ------------ stderr ------Unknown command: nonexistent