Skip to content

add short command aliases - #1369

Closed
chandlerok wants to merge 3 commits into
max-sixty:mainfrom
chandlerok:feat/chandlerok/command-aliases
Closed

chandlerok wants to merge 3 commits into
max-sixty:mainfrom
chandlerok:feat/chandlerok/command-aliases

Conversation

@chandlerok

@chandlerok chandlerok commented Mar 8, 2026 •

Copy link
Copy Markdown

Closes #1370

Summary

Adds short aliases for the most commonly used wt subcommands and flags:

Command aliases

Command Alias
wt switch wt s
wt list wt ls
wt remove wt rm

Short args for switch

Flag Short
--branches -B
--remotes -r

These use clap's visible_alias / short so they show up in --help output, making them discoverable.

Motivation

These commands and flags are the most frequently used in day-to-day workflows. Short aliases reduce typing friction — wt s -B and wt ls feel natural for users familiar with Unix conventions (ls, rm).

@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.

Nice idea — s, ls, rm are natural Unix-style aliases for the most-used commands, and visible_alias keeps them discoverable.

CI is red because the PR only updates src/cli/mod.rs but doesn't update the test artifacts that depend on the help output:

  1. Help snapshots — 4 snapshot files need the [aliases: ...] annotations added. Run cargo insta test --review (or cargo test + cargo insta review) to update them:

    • integration__integration_tests__help__help_root_short.snap
    • integration__integration_tests__help__help_root_long.snap
    • integration__integration_tests__help__help_no_args.snap
    • integration__integration_tests__help__help_md_root.snap
  2. Completion test — test_complete_subcommands_filter_options (at tests/integration_tests/completion.rs:962) asserts suggestions.contains(&"switch"). With aliases, clap's completion output format may have changed — worth investigating whether the aliases appear as separate completions or alter the existing entries.

Once the snapshots are regenerated and the completion test is fixed or updated, this should be good to go.

worktrunk-bot
worktrunk-bot previously approved these changes Mar 8, 2026

@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.

CI is red — 5 completion-related tests are failing because the short aliases changed the completion output but the corresponding snapshots weren't updated:

  • test_complete_subcommands_filter_options
  • test_bash_completion_subcommands
  • test_fish_completion_subcommands
  • test_nushell_completion_subcommands
  • test_zsh_completion_subcommands

This is the completion test concern from the previous review. The help snapshots were updated but the completion snapshots also need regenerating. Running cargo insta test --review with the shell-integration-tests feature should catch all of them:

cargo insta test --review --features shell-integration-tests

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.

[Feature Request] Add short command aliases for common subcommands

3 participants