Skip to content

feat: give each command a short form - #4

Merged
lorenzolfm merged 1 commit into
mainfrom
wt-d
Aug 30, 2026
Merged

lorenzolfm merged 1 commit into
mainfrom
wt-d

Conversation

@lorenzolfm

Copy link
Copy Markdown
Owner

wt delete is the command you type in the middle of other work, and it is the longest name in the tool. Each command that you run more than once for a repository now has a short form.

Command Short
wt share wt sh
wt add wt a
wt cd wt c
wt ls wt l
wt sync wt s
wt delete wt d
wt prune wt p

wt init and wt clone get none. Each is short already, and you run it one time for a repository.

A short form is a command

The forms are visible aliases, so wt --help prints each one beside its command:

delete      Remove a worktree and delete its branch [alias: d]

is_command already reads the aliases of a subcommand, so a short form is a command in every place that the tool asks the question. It wins over a worktree with the same name, the long form wt cd d reaches a worktree named d, and wt add d warns that it made one.

The fish integration

The wrapper function chooses between a command that writes for the user and a command that prints a path for cd. That choice reads a list of names, so each short form of a command that writes for the user belongs in it. Without d in the list, wt d eng-1234 would lose its output to the path test and print nothing.

The completions give both spellings of each command, and __fish_seen_subcommand_from takes the short form too, so wt d <TAB> still offers the worktrees and wt a <TAB> still offers the branches.

`wt delete` is the command you type in the middle of other work, and it is
the longest name in the tool. Each command that you run more than once for a
repository now has a short form: `sh` for share, `a` for add, `c` for cd, `l`
for ls, `s` for sync, `d` for delete and `p` for prune. `init` and `clone`
get none. Each is short already, and you run it one time for a repository.

The forms are visible aliases, so `wt --help` prints each one beside its
command, and `is_command` already reads the aliases of a subcommand. A short
form is therefore a command in every place that the tool asks the question:
it wins over a worktree with the same name, `wt cd d` reaches a worktree
named `d`, and `wt add d` warns that it made one.

The fish function chooses between a command that writes for the user and a
command that prints a path for `cd`. That list holds names, so each short
form of a command that writes for the user belongs in it. Without `d` in the
list, `wt d eng-1234` would lose its output to the path test. The completions
give both spellings of each command, and `__fish_seen_subcommand_from` takes
the short form too, so `wt d <TAB>` still offers the worktrees.
@lorenzolfm
lorenzolfm merged commit 4f652b3 into main Aug 30, 2026
4 checks passed
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.

1 participant