worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

Would you consider an 'alias' style support similar to what git has

Open cavanaug opened this issue 9 months ago • 8 comments

Especially the part about supporting ! execution of scripts.

I could create a wt alias for clone, that runs a basic script that sets up a bare repo, does a switch for the default branch, fixes up heads etc.

Folks could create a wt alias for ls=list

cavanaug avatar Feb 26 '26 11:02 cavanaug

Thanks for the suggestion! This is a feature request rather than a bug, so I'll leave it for a maintainer to evaluate and prioritize.

Worth noting that #406 tracks a related request for built-in shorthand support (wt ls, wt rm). This issue goes further by proposing user-configurable aliases with ! script execution, similar to git's [alias] config section. A maintainer can decide whether these should be addressed together or separately.

worktrunk-bot avatar Feb 26 '26 11:02 worktrunk-bot

yes I think this could work, and would be a solution to #406

let me think of a good design. I think we could use templating like we do in the other areas to provide a nice interface.

I wasn't looking to expand wt into a general task runner / etc, so we should think about how to keep it relatively focused!

max-sixty avatar Feb 26 '26 18:02 max-sixty

The combination of git alias and the auto resolution of “git xyz” to git-xyz are incredibly powerful extension capabilities. 2 simple ideas that brought forth tons of little customizations and scripts.

Yes there are some complexities with cli completion in these scenarios but once you have them I think you solve 90% of customization scenarios.

cavanaug avatar Feb 26 '26 20:02 cavanaug

+1. I would personally create something like wt new for wt switch -c. Alias support would be very nice.

masamerc avatar Mar 07 '26 02:03 masamerc

I created #1369 for this very purpose with default visible alias for switch (s), list (ls), and remove (rm). IMO s makes sense for switch given that its likely the most commonly used command, but ls and rm are objectively good UX given that they're unix convention. Would love to hear any feedback though!

chandlerok avatar Mar 08 '26 17:03 chandlerok

this is done https://github.com/max-sixty/worktrunk/pull/1348, at least to the extent we can experiment with it. Currently it's at wt step to keep the top level clean, we could consider promoting to top level depending on how it goes.

thank you for the suggestion @cavanaug !

will release soon, expect there to be some sharp corners for a couple of releases

max-sixty avatar Mar 08 '26 21:03 max-sixty

im looking forward to trying it out this week!! thanks!!

cavanaug avatar Mar 09 '26 05:03 cavanaug

@max-sixty Chiming in to say that supporting aliases at the new level would be most appreciated.

wt sw = wt switch wt ls = wt list wt new = wt switch -c etc

KieranP avatar Apr 06 '26 22:04 KieranP