Repository navigation
feat: give each command a short form - #4
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wt deleteis 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.wt sharewt shwt addwt awt cdwt cwt lswt lwt syncwt swt deletewt dwt prunewt pwt initandwt cloneget 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 --helpprints each one beside its command:is_commandalready 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 formwt cd dreaches a worktree namedd, andwt add dwarns 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. Withoutdin the list,wt d eng-1234would lose its output to the path test and print nothing.The completions give both spellings of each command, and
__fish_seen_subcommand_fromtakes the short form too, sowt d <TAB>still offers the worktrees andwt a <TAB>still offers the branches.