djui/alias-tips

Prefer the shortest command when there are multiple possible aliases

apaatsio opened this issue · 3 comments

Let's define two "overlapping" aliases (I'm using these via https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)

alias g='git'
alias gsta='git stash save'

Current behavior

$ git stash save                                                                                                          
Alias tip: g stash save

Preferred behavior

$ git stash save                                                                                                          
Alias tip: gsta

gsta is 4 characters and g stash save is 12 characters, so gsta should be preferred.

@djui, are you open to a PR for this? Tempted to work on it when I have time. Er, unless @apaatsio is hoping to do so, I don't want to deprive anyone of fun times.

@mrienstra Please, go ahead and have fun.

djui commented

@mrienstra Yes ofc! 🙏