Skip to content

refactor(help): compact the aliases section in --help - #2688

Merged
max-sixty merged 3 commits into
mainfrom
aliases-help
May 11, 2026
Merged

max-sixty merged 3 commits into
mainfrom
aliases-help

Conversation

@max-sixty

@max-sixty max-sixty commented May 11, 2026 •

Copy link
Copy Markdown
Owner

The Aliases: section in wt --help / wt step --help printed each alias's command template verbatim. Long one-liners (e.g. a landed = "wt up && wt hook post-merge; git merge ...") wrapped mid-token in an 80-column terminal and made the section look broken.

wt --help now shows just the alias names — deduped when the same name is defined in both user and project config, with shadowed-by-builtin still flagged inline — and points to wt config alias show for the full listing:

Aliases:
  landed, list (shadowed by built-in), sw, up

Run wt config alias show for the full definitions.

The detailed per-alias listing (name command-summary (source)) stays in render_aliases_section, which wt config alias show (no argument) reuses after #2684 — so --help is the compact orientation view and wt config alias show is the inspection view. A new render_aliases_help_section produces the compact form.

While in there: each styled name ends with a full reset (\e[0m), and the name list ends with a trailing space. The markdown pass over the spliced help text (wrap_styled_text) strips the \e[39m that cformat!'s </> emits and drops a reset that ends a line, so without these the last name's color bled onto the "Run …" sentence below. This also matches how clap closes each Commands: entry.

Merged main (which landed #2684's wt config alias show no-arg listing) and resolved the overlap in src/commands/alias.rs.

max-sixty and others added 2 commits May 10, 2026 22:43
The `Aliases:` block in `wt --help` / `wt step --help` printed each
alias's command template verbatim, which wrapped mid-token in narrow
terminals. Show just the alias names (deduped, shadowed-by-builtin still
flagged inline) and point to `wt config alias show` for the full
definitions. Drops `format_alias_summary` and its tests; consolidates
the `render_aliases_section` tests.

Also terminates each styled name with a full reset so its color doesn't
bleed onto the trailing hint line (the markdown pass strips the `\e[39m`
that `cformat!`'s `</>` emits).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two doc comments in src/commands/config/alias.rs (lines 5–6 and 82–83) still describe wt --help as rendering "the same Aliases: block ... via render_aliases_section" — which is no longer accurate after this PR (the help path now uses the new compact render_aliases_help_section, and render_aliases_section is reused only by wt config alias show). Happy to push a small follow-up updating both if you want.

The `config/alias.rs` doc comments described `wt --help` as rendering the
same `Aliases:` block via `render_aliases_section`; the help path now uses
the compact `render_aliases_help_section` instead. Addresses review
feedback on #2688.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 1a36910 into main May 11, 2026
31 checks passed
@max-sixty
max-sixty deleted the aliases-help branch May 11, 2026 06:12
max-sixty added a commit that referenced this pull request May 11, 2026
…#2689)

`render_aliases_help_section` (the compact `Aliases:` block in `wt
--help` / `wt step --help`, added in #2688) padded its joined alias-name
list with a trailing space, with a comment claiming `wrap_styled_text`
drops a reset that ends a line so the last name's color would otherwise
bleed onto the "Run `wt config alias show` …" line below.

That premise is wrong: `wrap-ansi` keeps a line-final `\x1b[0m`, so the
terminal output never bled. The trailing space only mattered against the
snapshot harness's `\x1b[0m\n` → `\n` filter, which would otherwise
strip the reset *from the snapshot* and make the diff *look* like a
bleed even though the binary is fine. So this drops the space (a stray
trailing space on that help line) and updates the two affected snapshots
accordingly — the binary still emits the line-final reset; only the
snapshot representation changes.

The per-name `anstyle::Reset` in that function stays — it's what keeps
the `, ` separators uncolored, matching how clap closes each `Commands:`
entry.

Also corrects the matching stale claim in `wrap_styled_text`'s doc
comment ("we move these to line ends" → the code strips leading resets
and leaves line-final resets in place — verified directly against the
locked `wrap-ansi 0.1.0`).

Thanks to the auto-reviewer for catching that the originally-proposed
`wrap_styled_text` fix was dead code (codecov showed the new branch
never executed).

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@max-sixty max-sixty mentioned this pull request May 13, 2026
max-sixty added a commit that referenced this pull request May 13, 2026
Release v0.50.0.

Highlights:

- Experimental Azure DevOps support (#1256, thanks @mikeyroush; fixes
#1144 from @dlecan) — `wt switch pr:<N>`, `wt list --full`, and `wt
config show --full` recognize Azure DevOps via the `az` CLI.
- Experimental Gitea CI-status detection (#2702) on top of the Gitea
`pr:` shortcut (#1320, thanks @SjB).
- Hooks now resolve `.config/wt.toml` from the worktree they act on —
the primary-worktree fallback is gone, and `post-remove` reads the
removed worktree's config (snapshotted before removal). Approval prompts
collect hook commands from the same worktree. Breaking change for setups
that relied on the primary-worktree fallback; the changelog entry has
the recovery action. (#2690, #2703, #2714, #2717, #2701, #2708, #2727,
#2736, #2748)
- The `wt switch` picker's `alt-r` removal no longer runs unapproved
project hooks (#2746) — the picker's removal path is now routed through
`handle_remove_output` and consults the existing approval state
read-only.
- `wt config alias show` with no name lists every alias's full
definition (#2684, #2691); `wt --help` switches to a compact aliases
pointer (#2688).
- `wt list --branches` warm-run perf: SHA-keyed cache for `main↕` and
`Remote⇅` ahead/behind counts; shared push-remote URL and local-branch
scan (#2704, #2718, #2673).
- Claude Code plugin ships the `wt-switch-create` skill (#2737, thanks
@onetom for #2631).

See `CHANGELOG.md` for the full list (8 Improved, 5 Fixed, 5 Internal).

semver-checks reports breaking library-API changes (new enum variants
without `#[non_exhaustive]`, removed `Branch::github_push_url`, new
trait method on `RemoteRefProvider`), which mandates at minimum a minor
bump pre-1.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants