worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

docs(switch): refine wt switch --help text

Open worktrunk-bot opened this issue 5 months ago • 0 comments

Summary

Picks up the four wt switch --help refinements from #3095:

  1. Use backtick emphasis for shortcut symbols (^, -, @, pr:{N}, mr:{N}) instead of single quotes — matches the existing style on --base.
  2. Surface PR/MR URL acceptance in the [BRANCH] argument summary ("Branch name, shortcut, or PR/MR URL"), so the short help mirrors what the long help already documents.
  3. Rewrite the Forks paragraph as prose, opening with "If the PR or MR is on a fork…" and using descriptive mood ("requires renaming") instead of imperative ("rename it first"). Drops the (e.g., feature-fix) example.
  4. Consolidate the per-forge notes — the Requires line, the standalone Gitea (experimental) paragraph, and the standalone Azure DevOps (experimental) paragraph — into a single footer pointing at forge platform for the platform-specific setup.

Before / after — Pull requests and merge requests section

Before:

Both work anywhere a branch is accepted, including --base.

Requires gh (GitHub) or glab (GitLab) CLI to be installed and authenticated. The --create flag cannot be used with a PR/MR reference since the branch already exists.

Forks: The local branch uses the PR/MR's branch name directly (e.g., feature-fix), so git push works normally. If a local branch with that name already exists tracking something else, rename it first.

Gitea (experimental): pr: is also compatible with Gitea via the tea CLI. Set [forge] platform = "gitea" in .config/wt.toml to opt in; worktrunk also auto-detects Gitea when the remote host contains gitea or when tea login add has been run for the host.

Azure DevOps (experimental): pr: is also compatible with Azure DevOps via the az CLI (with the azure-devops extension). Set [forge] platform = "azure-devops" in .config/wt.toml to opt in; worktrunk also auto-detects Azure DevOps from dev.azure.com and *.visualstudio.com remotes.

After:

Both work anywhere a branch is accepted, including --base. The --create flag cannot be used with a PR/MR reference since the branch already exists.

If the PR or MR is on a fork, the local branch uses its branch name directly, so git push works normally. A pre-existing local branch with that name tracking something else requires renaming first.

Requires gh (GitHub), glab (GitLab), or an equivalent CLI installed and authenticated; see forge platform for Gitea, Azure DevOps, and other supported platforms.

Testing

  • cargo test --test integration test_docs_are_in_sync — generated docs mirrors regenerated and now in sync.
  • cargo test --test integration test_help — short and long switch --help snapshots updated.
  • cargo build — clean compile.
  • Inspected the rendered wt switch --help output to confirm the shortcuts render with bold emphasis and the consolidated footer reads cleanly.

Notes for review

  • I did not sweep other --help pages for parenthesized "e.g." examples — the issue mentioned looking for more, but I scoped this PR to the switch help and left the broader pass for a maintainer call. One other in-scope candidate at src/cli/mod.rs:569 (Switching to a remote branch (e.g., wt switch feature when only origin/feature exists) creates a local tracking branch.) felt like a useful clarification of "remote branch" rather than a redundant example, so I left it alone.
  • The forge-platform link uses the @/config.md#forge-platform form that the rest of after_long_help uses for cross-doc references.

Closes #3095 — automated triage

worktrunk-bot avatar Jun 16 '26 17:06 worktrunk-bot